Compare commits

...

58 Commits
master ... f12

Author SHA1 Message Date
Jan Kratochvil f6d64e73ff - Fix crash on MI variable calling inferior function (BZ 610986). 2010-08-19 11:02:06 +02:00
Fedora Release Engineering 859be95e2c dist-git conversion 2010-07-28 15:15:08 +00:00
Jan Kratochvil b1549146f7 - Fix prelinked executables with sepdebug and copy relocations (BZ 614659).
- [delayed-symfile] Fix a backtrace regression on CFIs without DIE (BZ
    614604).
2010-07-20 17:52:38 +00:00
Jan Kratochvil e9c357edd0 - Fix Java-related crash (BZ 566145, Tom Tromey). 2010-06-02 11:05:40 +00:00
Jan Kratochvil 5e502f39e4 - Fix follow-exec for C++ programs (bugreported by Martin Stransky). 2010-05-29 00:01:43 +00:00
Jan Kratochvil 2897558ca7 - Fix lock up on loops in the solib chain (BZ 593926).
- Import fix of TUI layout internal error (BZ 595475).
2010-05-24 19:04:48 +00:00
Jan Kratochvil 0b00d5414f - Fix crash when using GNU IFUNC call from breakpoint condition. 2010-04-26 00:55:13 +00:00
Jan Kratochvil bdfd6d1b43 - Fix pretty printers regression in 7.0.1-40.fc12 (Phil Muldoon, BZ
582052).
2010-04-14 10:41:48 +00:00
Jan Kratochvil e20f36ceed - Fix gstack to print even the frame #0. New gdb.base/gstack.exp. (BZ
579793)
2010-04-07 20:34:04 +00:00
Jan Kratochvil a63256c33f - Merge gdb-6.3-gstack-without-path-20060414.p* into
gdb-6.3-gstack-20050411.p*, no real code change.
2010-04-07 18:40:34 +00:00
Jan Kratochvil 2e2f074f03 - Fix also false warning: section .dynbss not found in ... 2010-04-05 19:53:59 +00:00
Jan Kratochvil 855ae15dd6 - Upgrade libstdc++ Python pretty printers to r155978 (Phil Muldoon, BZ
561541).
2010-04-04 09:35:29 +00:00
Jan Kratochvil 1af55b59fd - Fix dangling displays in separate debuginfo (BZ 574483). 2010-04-03 10:24:58 +00:00
Jan Kratochvil 0e42458d97 - [expr-cumulative] Fix using-directive memory leak (Sami Wagiaalla, BZ
578351).
2010-04-02 22:05:55 +00:00
Jan Kratochvil 2459ca53eb - Fix crash due to gdb-readline-6.0-signal.patch (BZ 575516) 2010-03-31 21:27:43 +00:00
Jan Kratochvil 2ee26b3c6e - Fix incorrect relocation of sections with duplicate name (BZ 575737). 2010-03-26 19:15:23 +00:00
Dennis Gilmore 1d79a59635 - dont apply gdb-bz539590-gnu-ifunc.patch on sparc
- we dont yet have the support in glibc
2010-03-26 14:55:23 +00:00
Jan Kratochvil 4b77e42af7 - Drop gdb-6.5-bz218379-ppc-solib-trampoline-fix.patch having false symbols
resolving (related to BZ 573277).
2010-03-14 23:37:16 +00:00
Jan Kratochvil 17e05a93c3 - Fix parsing of gcc -feliminate-dwarf2-dups binaries (Tom Tromey, BZ
552619).
- Fix crash on pretty printed object by MI (Tom Tromey, BZ 560034).
- [delayed-symfile] Fix crash on failed reading psymtab (Tom Tromey, BZ
    561784).
- Fix double-free on std::terminate handler (Tom Tromey, BZ 562975).
2010-03-12 13:37:58 +00:00
Jan Kratochvil 2ca842aedb - [delayed-symfile] Backport fix of reread_symbols (Tom Tromey, BZ 562517).
- Fix false warning: section .gnu.liblist not found in ...
2010-02-28 23:28:44 +00:00
Jan Kratochvil 5a6df07a01 - Fix gdb.ada/* regressions (Keith Seitz).
- Disable addon (finish) due to inline-cmds.exp: up from outer_inline2
    assert.
- Fix i386+x86_64 rwatch+awatch before run, regression against 6.8 (BZ
    541866).
- Fix crash on stale addrinfo->sectindex (more sensitive due to the PIE
    patch).
- Remove false gdb_assert on $sp underflow.
- Workaround ia64 inferior calls clearing SP.
- testsuite: Fix long timeout on arches with failing
    gdb.base/interrupt.exp.
- Fix ia64 part of the bt-clone-stop.exp fix.
2010-02-26 01:18:33 +00:00
Jan Kratochvil 29da87712f - Fortran: Fix regression on setting breakpoint at toplevel symbols (BZ
559291).
2010-02-03 01:11:13 +00:00
Jan Kratochvil 14c9aeaffe - Fix failed gdb_assert due to the PIE patchset (BZ 559414). 2010-01-31 02:00:42 +00:00
Jan Kratochvil 2dcdbb7e9c - Disable break-by-name on inlined functions due to a regression on
parameters of inlined functions falsely <optimized out> (BZ 556975
    Comment 8).
2010-01-22 11:26:08 +00:00
Jan Kratochvil 3cd4b7f6f2 - GNU IFUNCs compilation fixup for ppc*. 2010-01-21 21:29:14 +00:00
Jan Kratochvil d54d6b57e2 - Fix GNU IFUNCs - indirect functions - support (BZ 539590). 2010-01-21 20:07:27 +00:00
Jan Kratochvil de6a7ee761 - Fix crash while executing python code. 2010-01-13 23:37:33 +00:00
Jan Kratochvil df99b64f73 - non-librpm missing debuginfo yumcommand now prints also --disablerepo='*'
to save some bandwidth by yum (Robin Green, BZ 554152).
2010-01-12 19:05:27 +00:00
Jan Kratochvil b9ec9d70fa - testsuite: BuildRequires also valgrind. 2010-01-10 18:39:30 +00:00
Jan Kratochvil 9bf63cd32f - Workaround missing libstdc++%{bits_other} in Koji. 2010-01-08 11:24:37 +00:00
Jan Kratochvil 22dfdc2511 - Comply with new package review:
- Fix .spec Source as this is not a snapshot now.
- Convert all spaces to tabs.
- Fix missing %defattr at %files for gdbserver.
- Replace all hardcoded-library-path by variants of %{_isa}.
- Include %{_isa} for appropriate Requires and BuildRequires.
2010-01-08 10:48:29 +00:00
Jan Kratochvil 2fbfb7cad3 - [vla] Fix regression on fields of structs in internal vars (BZ 553338).
- archer-jankratochvil-fedora12 commit:
    6e73988f653ba986e8742f208f17ec084292cbd5
2010-01-07 20:58:52 +00:00
Jan Kratochvil 2356bfea4c - Fix crash reading broken stabs (it377671). 2010-01-07 18:09:09 +00:00
Jan Kratochvil c749ff6478 - testsuite: Fixup false FAILs for gdb.cp/constructortest.exp. 2010-01-03 11:00:18 +00:00
Jan Kratochvil d7bd836d26 - Fix regression of gdb-7.0 (from 6.8) crashing on typedefed bitfields.
- Fix related_breakpoint stale ref crash.
2010-01-02 21:26:54 +00:00
Jan Kratochvil 2e0773b161 - Formal upgrade to the FSF GDB release gdb-7.0.1.
- Fix regression of gdb-7.0.1 not preserving typedef of a field.
2010-01-01 19:07:41 +00:00
Jan Kratochvil fe319bcb78 - More RHEL-5 compatibility updates.
- Disable the build-id support by default.
- Bundle back gdbserver to the base gdb package.
- Remove bundled pstack.
- Drop the BuildRequires of rpm-devel.
2010-01-01 15:15:34 +00:00
Jan Kratochvil 2ec2c9621e %changlog timestamp fixup. 2010-01-01 11:06:50 +00:00
Jan Kratochvil a259cc2ba7 - Fix error on a sw watchpoint active at function epilogue (hit on s390x).
- testsuite: Fix false MI "unknown output after running" regression.
- testsuite: Update ia64-sigtramp.exp for recent GDB.
- Implement bt-clone-stop.exp fix also for ia64.
- testsuite: Upstream condbreak.exp results stability fix (Daniel
    Jacobowitz).
2010-01-01 11:06:08 +00:00
Jan Kratochvil 709107db49 - testsuite: Fix constructortest.exp and expand-sals.exp for
gcc-4.4.2-20.fc12.
2009-12-24 22:39:35 +00:00
Jan Kratochvil 367485a7c6 - [pie] Fix a race in testcase gdb.base/valgrind-db-attach.exp.
- Fix regression by python on ia64 due to stale current frame.
- Disable python iff RHEL-5 && (Brew || ppc64).
2009-12-21 22:46:49 +00:00
Jan Kratochvil f056ae4c36 - Workaround build on native ppc64 host.
- More RHEL-5 compatibility updates.
- Disable warning messages new for gdb-6.8+ for RHEL-5 backward
    compatibility.
- Workaround RHEL-5 kernels for detaching SIGSTOPped processes (BZ 498595).
- Serialize the testsuite output to keep the order for regression checks.
- Re-enable python for all non-ppc* arches.
- More gcc44 stack exceptions when running the testsuite on RHEL-5.
- Fix backward compatibility with G++ 4.1 namespaces "::".
- Fix regression on re-setting the single ppc watchpoint slot.
- Update snapshot of FSF gdb-7.0.x branch.
- Backport fix of dcache invalidation locking up GDB on ppc64 targets.
2009-12-21 11:26:48 +00:00
Jan Kratochvil cdcc8d96c2 Fixup %{release}. 2009-12-18 09:51:52 +00:00
Jan Kratochvil 059aafdd99 - [pie] Fix general ppc64 regression due to a function descriptors bug.
- [pie] Fix also keeping breakpoints disabled in PIE mode.
- Import upstream <tab>-completion crash fix.
- Drop some unused patches from the repository.
- More RHEL-5 build compatibility updates.
- Use gfortran44 when running the testsuite on RHEL-5.
- Disable python there due to insufficient ppc multilib.
- Fix orphanripper hangs and thus enable it again.
2009-12-18 09:48:50 +00:00
Jan Kratochvil d492495bcf - Make gdb-6.3-rh-testversion-20041202.patch to accept both RHEL and Fedora
GDB.
- Adjust BuildRequires for Fedora-12, RHEL-6 and RHEL-5 builds.
- [vla] Fix compatibility of dynamic arrays with iFort (BZ 514287).
- Fix stepping through OMP parallel Fortran sections (BZ 533176).
- New fix of bp conditionals [bp_location-accel] regression (BZ 538626).
2009-12-14 18:54:51 +00:00
Jan Kratochvil c5f8fe0a54 - 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
2009-12-07 18:39:26 +00:00
Jan Kratochvil e0f371ca6c - Fix slowness/hang when printing some variables (Sami Wagiaalla, BZ
541093).
- archer-jankratochvil-fedora12 commit:
    6817a81cd411acc9579f04dcc105e9bce72859ff
2009-12-03 16:26:37 +00:00
Bill Nottingham 5c8987900e Fix typo that causes a failure to update the common directory. (releng
#2781)
2009-11-26 01:53:59 +00:00
Jan Kratochvil 9bb4d3d924 - Support GNU IFUNCs - indirect functions (BZ 539590).
- Fix bp conditionals [bp_location-accel] regression (Phil Muldoon, BZ
    538626).
- Fix missed breakpoint location [bp_location-accel] regression (upstream).
2009-11-25 10:38:24 +00:00
Jan Kratochvil 6e5cc88fad - Fix missing zlib-devel BuildRequires to support compressed DWARF
sections.
- Include post-7.0 FSF GDB fixes.
2009-10-30 19:52:28 +00:00
Jan Kratochvil c5c5004db4 - Make the package buildable on RHEL-5/CentOS-5 (without librpm there).
- archer-jankratochvil-fedora12 commit:
    5b73ea6a0f74e63db3b504792fc1d37f548bdf5c
2009-10-23 20:05:50 +00:00
Jan Kratochvil 5135752b6b - Fix rpm --excludedocs (BZ 515998). 2009-10-23 18:29:19 +00:00
Jan Kratochvil d4a047fbf7 - Support multiple directories for `set debug-file-directory' (BZ 528668). 2009-10-22 23:52:25 +00:00
Jan Kratochvil e4ac510550 - Sync the .spec with RHEL/CentOS without EPEL, do not BuildRequires: fpc
there.
2009-10-19 04:56:47 +00:00
Jan Kratochvil 0275674bdf - Formal upgrade to the final FSF GDB release gdb-7.0.
- Fix GNU/Linux core open: Can't read pathname for load map: Input/output
    error.
- archer-jankratochvil-fedora12 commit:
    ce4ead356654b951a49ca78d81ebfff95e758bf5
2009-10-07 19:17:19 +00:00
Jan Kratochvil af25c22136 - Bump release. 2009-09-30 21:03:20 +00:00
Jan Kratochvil deaddecb8c - Fix broken python "help()" command "modules" (BZ 526552).
- Upgrade to the FSF GDB gdb-7.0 snapshot: 6.8.91.20090930
- archer-jankratochvil-fedora12 commit:
    7cb860f03e2437c97239334ebe240d06f45723e0
2009-09-30 21:02:26 +00:00
Jesse Keating 594bbdcc98 Initialize branch F-12 for gdb 2009-09-29 04:54:23 +00:00
76 changed files with 13095 additions and 2542 deletions

View File

@ -1,2 +0,0 @@
libstdc++-v3-python-r151798.tar.xz
gdb-6.8.91.20090925.tar.bz2

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
gdb-7.0.1.tar.bz2
libstdc++-v3-python-r155978.tar.bz2

View File

@ -1,21 +0,0 @@
# Makefile for source rpm: gdb
# $Id: Makefile,v 1.2 2007/05/30 14:38:39 kasal Exp $
NAME := gdb
SPECFILE = $(firstword $(wildcard *.spec))
define find-makefile-common
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
endef
MAKEFILE_COMMON := $(shell $(find-makefile-common))
ifeq ($(MAKEFILE_COMMON),)
# attempt a checkout
define checkout-makefile-common
test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
endef
MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
endif
include $(MAKEFILE_COMMON)

View File

@ -1,23 +0,0 @@
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=182116
Index: gdb-6.5/gdb/linux-thread-db.c
===================================================================
--- gdb-6.5.orig/gdb/linux-thread-db.c 2006-08-24 02:55:24.000000000 -0300
+++ gdb-6.5/gdb/linux-thread-db.c 2006-08-24 02:56:16.000000000 -0300
@@ -939,6 +939,15 @@ thread_db_wait (ptid_t ptid, struct targ
|| ourstatus->kind == TARGET_WAITKIND_SIGNALLED)
return pid_to_ptid (-1);
+ if (ourstatus->kind == TARGET_WAITKIND_EXECD)
+ {
+ remove_thread_event_breakpoints ();
+ unpush_target (&thread_db_ops);
+ using_thread_db = 0;
+
+ return pid_to_ptid (GET_PID (ptid));
+ }
+
if (ourstatus->kind == TARGET_WAITKIND_STOPPED
&& (ourstatus->value.sig == TARGET_SIGNAL_TRAP
|| ourstatus->value.sig == TARGET_SIGNAL_ILL))

View File

@ -4,10 +4,9 @@
to install and uninstall.
* gstack.sh, gstack.1: New files.
Index: gdb-6.8.91.20090917/gdb/Makefile.in
===================================================================
--- gdb-6.8.91.20090917.orig/gdb/Makefile.in 2009-09-17 12:47:07.000000000 +0200
+++ gdb-6.8.91.20090917/gdb/Makefile.in 2009-09-17 12:47:38.000000000 +0200
diff -up -ruNp gdb-7.0.1-empty/gdb/Makefile.in gdb-7.0.1/gdb/Makefile.in
--- gdb-7.0.1-empty/gdb/Makefile.in 2010-04-07 20:36:04.000000000 +0200
+++ gdb-7.0.1/gdb/Makefile.in 2010-04-07 20:36:42.000000000 +0200
@@ -989,7 +989,7 @@ install: all install-only
# The "install-only" target also installs the syscalls' XML files in
@ -63,10 +62,9 @@ Index: gdb-6.8.91.20090917/gdb/Makefile.in
# The C++ name parser can be built standalone for testing.
test-cp-name-parser.o: cp-name-parser.c
Index: gdb-6.8.91.20090917/gdb/gstack.sh
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.8.91.20090917/gdb/gstack.sh 2009-09-17 12:47:14.000000000 +0200
diff -up -ruNp gdb-7.0.1-empty/gdb/gstack.sh gdb-7.0.1/gdb/gstack.sh
--- gdb-7.0.1-empty/gdb/gstack.sh 1970-01-01 01:00:00.000000000 +0100
+++ gdb-7.0.1/gdb/gstack.sh 2010-04-07 20:36:47.000000000 +0200
@@ -0,0 +1,48 @@
+#!/bin/sh
+
@ -87,17 +85,17 @@ Index: gdb-6.8.91.20090917/gdb/gstack.sh
+backtrace="bt"
+if test -d /proc/$1/task ; then
+ # Newer kernel; has a task/ directory.
+ if test `ls /proc/$1/task | wc -l` -gt 1 2>/dev/null ; then
+ if test `/bin/ls /proc/$1/task | /usr/bin/wc -l` -gt 1 2>/dev/null ; then
+ backtrace="thread apply all bt"
+ fi
+elif test -f /proc/$1/maps ; then
+ # Older kernel; go by it loading libpthread.
+ if grep -e libpthread /proc/$1/maps > /dev/null 2>&1 ; then
+ if /bin/grep -e libpthread /proc/$1/maps > /dev/null 2>&1 ; then
+ backtrace="thread apply all bt"
+ fi
+fi
+
+GDB=${GDB:-gdb}
+GDB=${GDB:-/usr/bin/gdb}
+
+if $GDB -nx --quiet --batch --readnever > /dev/null 2>&1; then
+ readnever=--readnever
@ -112,7 +110,127 @@ Index: gdb-6.8.91.20090917/gdb/gstack.sh
+set pagination no
+$backtrace
+EOF
+sed -n \
+ -e 's/^(gdb) //' \
+/bin/sed -n \
+ -e 's/^\((gdb) \)*//' \
+ -e '/^#/p' \
+ -e '/^Thread/p'
--- /dev/null 2010-04-07 06:20:52.289994508 +0200
+++ gdb-7.0.1/gdb/testsuite/gdb.base/gstack.exp 2010-04-07 21:53:57.000000000 +0200
@@ -0,0 +1,71 @@
+# Copyright (C) 2010 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/>.
+
+set testfile gstack
+set executable ${testfile}
+set binfile ${objdir}/${subdir}/$executable
+if {[build_executable ${testfile} ${executable} "" {debug}] == -1} {
+ return -1
+}
+
+set test "spawn inferior"
+set command "${binfile}"
+set res [remote_spawn host $command];
+if { $res < 0 || $res == "" } {
+ perror "Spawning $command failed."
+ fail $test
+ return
+}
+set pid [exp_pid -i $res]
+gdb_expect {
+ -re "looping\r\n" {
+ pass $test
+ }
+ eof {
+ fail "$test (eof)"
+ return
+ }
+ timeout {
+ fail "$test (timeout)"
+ return
+ }
+}
+gdb_exit
+
+# Testcase uses the most simple notification not to get caught by attach on
+# exiting the function. Still we could retry the gstack command if we fail.
+
+set test "spawn gstack"
+set command "sh -c GDB=$GDB\\ sh\\ ${srcdir}/../gstack.sh\\ $pid\\;echo\\ GSTACK-END"
+set res [remote_spawn host $command];
+if { $res < 0 || $res == "" } {
+ perror "Spawning $command failed."
+ fail $test
+}
+set pid [exp_pid -i $res]
+gdb_expect {
+ -re {^#0 +0x[0-9a-f]+ in func \(\)\r\n#1 +0x[0-9a-f]+ in main \(\)\r\nGSTACK-END\r\n$} {
+ pass $test
+ }
+ eof {
+ fail "$test (eof)"
+ }
+ timeout {
+ fail "$test (timeout)"
+ }
+}
+gdb_exit
+
+remote_exec host "kill -9 $pid"
--- /dev/null 2010-04-07 06:20:52.289994508 +0200
+++ gdb-7.0.1/gdb/testsuite/gdb.base/gstack.c 2010-04-07 21:46:52.000000000 +0200
@@ -0,0 +1,43 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2005, 2007, 2008, 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 <stdio.h>
+#include <unistd.h>
+#include <string.h>
+
+void
+func (void)
+{
+ const char msg[] = "looping\n";
+
+ /* Use the most simple notification not to get caught by attach on exiting
+ the function. */
+ write (1, msg, strlen (msg));
+
+ for (;;);
+}
+
+int
+main (void)
+{
+ alarm (60);
+ nice (100);
+
+ func ();
+
+ return 0;
+}

View File

@ -1,34 +0,0 @@
Index: gdb-6.3/gdb/gstack.sh
===================================================================
--- gdb-6.3.orig/gdb/gstack.sh 2006-02-14 17:21:05.000000000 -0200
+++ gdb-6.3/gdb/gstack.sh 2006-04-14 03:17:12.000000000 -0300
@@ -17,17 +17,17 @@ fi
backtrace="bt"
if test -d /proc/$1/task ; then
# Newer kernel; has a task/ directory.
- if test `ls /proc/$1/task | wc -l` -gt 1 2>/dev/null ; then
+ if test `/bin/ls /proc/$1/task | /usr/bin/wc -l` -gt 1 2>/dev/null ; then
backtrace="thread apply all bt"
fi
elif test -f /proc/$1/maps ; then
# Older kernel; go by it loading libpthread.
- if grep -e libpthread /proc/$1/maps > /dev/null 2>&1 ; then
+ if /bin/grep -e libpthread /proc/$1/maps > /dev/null 2>&1 ; then
backtrace="thread apply all bt"
fi
fi
-GDB=${GDB:-gdb}
+GDB=${GDB:-/usr/bin/gdb}
if $GDB -nx --quiet --batch --readnever > /dev/null 2>&1; then
readnever=--readnever
@@ -39,7 +39,7 @@ fi
set pagination no
$backtrace
EOF
-sed -n \
+/bin/sed -n \
-e 's/^(gdb) //' \
-e '/^#/p' \
-e '/^Thread/p'

View File

@ -1,28 +0,0 @@
2005-01-25 Jeff Johnston <jjohnstn@redhat.com>
* ia64-tdep.c (getunwind_table): Call the low-level xfer
unwind table syscall to support backtracing from syscalls in
a corefile.
Index: gdb-6.5/gdb/ia64-tdep.c
===================================================================
--- gdb-6.5.orig/gdb/ia64-tdep.c 2006-04-18 16:20:06.000000000 -0300
+++ gdb-6.5/gdb/ia64-tdep.c 2006-07-07 02:18:40.000000000 -0300
@@ -2470,8 +2470,17 @@ getunwind_table (void *buf, size_t len)
we want to preserve fall back to the running kernel's table, then
we should find a way to override the corefile layer's
xfer_partial method. */
+#if 0
x = target_read_partial (&current_target, TARGET_OBJECT_UNWIND_TABLE, NULL,
buf, 0, len);
+#endif
+ /* FIXME: This is a temporary solution to backtracing syscalls in corefiles.
+ To do this properly, the AUXV section should be used. This
+ fix will work as long as the kernel used to generate the corefile
+ is equivalent to the kernel used to debug the corefile. */
+ x = ia64_linux_xfer_unwind_table (&current_target,
+ TARGET_OBJECT_UNWIND_TABLE, NULL,
+ buf, NULL, 0, len);
return (int)x;
}

View File

@ -41,7 +41,7 @@ testsuite:
+
--- gdb-6.3/gdb/testsuite/gdb.arch/ia64-sigtramp.exp.fix 2005-07-25 16:42:50.000000000 -0400
+++ gdb-6.3/gdb/testsuite/gdb.arch/ia64-sigtramp.exp 2005-07-25 16:42:01.000000000 -0400
@@ -0,0 +1,66 @@
@@ -0,0 +1,73 @@
+# Copyright 2005 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
@ -90,7 +90,10 @@ testsuite:
+}
+
+gdb_exit
+set match_max_old [match_max]
+match_max -d 1000000
+gdb_start
+match_max -d $match_max_old
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
@ -106,5 +109,9 @@ testsuite:
+gdb_test "continue" "Breakpoint.*x.*" "continue to x"
+
+gdb_test "f 1" ".*signal handler called.*" "frame 1"
+gdb_test "info frame" "Stack level 1.*p63 at .*" "info sigtramp frame"
+
+
+# gdb-7.0+ no longer prints the pseudo registers as they are computed.
+# frame_info says: /* For moment, only display registers that were saved on the
+# stack. */
+gdb_test "set debug frame 1"
+gdb_test "info frame" "Stack level 1, .*frame_unwind_register_value \\(frame=1,regnum=750\\(p63\\),\[^\r\n\]*\r\n\[^\r\n\]*-> computed bytes=.*" "info sigtramp frame"

View File

@ -29,7 +29,7 @@ Index: gdb-6.8.50.20081128/gdb/ia64-tdep.c
+ ULONGEST unatN_val;
+ ULONGEST unat;
+ read_memory (cache->saved_regs[IA64_UNAT_REGNUM], (char *) &unat,
+ register_size (current_gdbarch, IA64_UNAT_REGNUM));
+ register_size (target_gdbarch, IA64_UNAT_REGNUM));
+ unatN_val = (unat & (1LL << (regnum - IA64_NAT0_REGNUM))) != 0;
+ return frame_unwind_got_constant (this_frame, regnum, unatN_val);
+ }
@ -45,9 +45,9 @@ Index: gdb-6.8.50.20081128/gdb/ia64-tdep.c
+ CORE_ADDR gr_addr = 0, nat_addr = 0;
+
+ read_memory (cache->saved_regs[IA64_BSP_REGNUM], (char *) &bsp,
+ register_size (current_gdbarch, IA64_BSP_REGNUM));
+ register_size (target_gdbarch, IA64_BSP_REGNUM));
+ read_memory (cache->saved_regs[IA64_CFM_REGNUM], (char *) &cfm,
+ register_size (current_gdbarch, IA64_CFM_REGNUM));
+ register_size (target_gdbarch, IA64_CFM_REGNUM));
+
+ /* The bsp points at the end of the register frame so we
+ subtract the size of frame from it to get start of register frame. */
@ -71,10 +71,10 @@ Index: gdb-6.8.50.20081128/gdb/ia64-tdep.c
+ nat_addr = cache->saved_regs[IA64_RNAT_REGNUM];
+ if (nat_addr != 0)
+ read_memory (nat_addr, (char *) &nat_collection,
+ register_size (current_gdbarch, IA64_RNAT_REGNUM));
+ register_size (target_gdbarch, IA64_RNAT_REGNUM));
+ }
+ else
+ nat_collection = read_memory_integer (nat_addr, 8);
+ nat_collection = read_memory_integer (nat_addr, 8, BFD_ENDIAN_LITTLE);
+ if (nat_addr != 0)
+ {
+ nat_bit = (gr_addr >> 3) & 0x3f;
@ -97,9 +97,9 @@ Index: gdb-6.8.50.20081128/gdb/ia64-tdep.c
+ ULONGEST bof;
+
+ read_memory (cache->saved_regs[IA64_BSP_REGNUM], (char *) &bsp,
+ register_size (current_gdbarch, IA64_BSP_REGNUM));
+ register_size (target_gdbarch, IA64_BSP_REGNUM));
+ read_memory (cache->saved_regs[IA64_CFM_REGNUM], (char *) &cfm,
+ register_size (current_gdbarch, IA64_CFM_REGNUM));
+ register_size (target_gdbarch, IA64_CFM_REGNUM));
+
+ /* The bsp points at the end of the register frame so we
+ subtract the size of frame from it to get beginning of frame. */
@ -133,9 +133,9 @@ Index: gdb-6.8.50.20081128/gdb/ia64-tdep.c
+ ULONGEST cfm;
+ ULONGEST prN_val;
+ read_memory (pr_addr, (char *) &pr,
+ register_size (current_gdbarch, IA64_PR_REGNUM));
+ register_size (target_gdbarch, IA64_PR_REGNUM));
+ read_memory (cache->saved_regs[IA64_CFM_REGNUM], (char *) &cfm,
+ register_size (current_gdbarch, IA64_CFM_REGNUM));
+ register_size (target_gdbarch, IA64_CFM_REGNUM));
+
+ /* Get the register rename base for this frame and adjust the
+ * register name to take rotation into account. */

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

@ -11,8 +11,8 @@ Index: gdb-6.8/gdb/testsuite/gdb.gdb/selftest.exp
-re ".\[0-9\]+ = +.+ +0x.*\[0-9.\]+.*$gdb_prompt $" {
pass "printed version with cast"
}
+ -re ".\[0-9\]+ = .Fedora \[\\(\\)0-9.a-z\\-\]+.*$gdb_prompt $" {
+ pass "printed version Fedora only"
+ -re ".\[0-9\]+ = .(Fedora|Red Hat Enterprise Linux) \[\\(\\)0-9.a-z\\-\]+.*$gdb_prompt $" {
+ pass "printed version Fedora or Red Hat Enterprise Linux only"
+ }
-re ".*$gdb_prompt $" { fail "printed version" }
timeout { fail "(timeout) printed version" }

View File

@ -1,82 +0,0 @@
2005-04-02 Andrew Cagney <cagney@gnu.org>
* symfile.c (separate_debug_file_exists): When the CRCs mismatch
print a warning.
(find_separate_debug_file): Pass in the objfile's name.
Index: gdb-6.8.50.20081128/gdb/symfile.c
===================================================================
--- gdb-6.8.50.20081128.orig/gdb/symfile.c 2008-10-03 18:36:10.000000000 +0200
+++ gdb-6.8.50.20081128/gdb/symfile.c 2008-12-01 16:34:36.000000000 +0100
@@ -1296,7 +1296,8 @@ get_debug_link_info (struct objfile *obj
}
static int
-separate_debug_file_exists (const char *name, unsigned long crc)
+separate_debug_file_exists (const char *name, unsigned long crc,
+ const char *parent_name)
{
unsigned long file_crc = 0;
bfd *abfd;
@@ -1316,7 +1317,15 @@ separate_debug_file_exists (const char *
bfd_close (abfd);
- return crc == file_crc;
+ if (crc != file_crc)
+ {
+ warning (_("the debug information found in \"%s\""
+ " does not match \"%s\" (CRC mismatch).\n"),
+ name, parent_name);
+ return 0;
+ }
+
+ return 1;
}
char *debug_file_directory = NULL;
@@ -1368,6 +1377,8 @@ find_separate_debug_file (struct objfile
basename = get_debug_link_info (objfile, &crc32);
if (basename == NULL)
+ /* There's no separate debug info, hence there's no way we could
+ load it => no warning. */
return NULL;
dir = xstrdup (objfile->name);
@@ -1395,7 +1406,7 @@ find_separate_debug_file (struct objfile
strcpy (debugfile, dir);
strcat (debugfile, basename);
- if (separate_debug_file_exists (debugfile, crc32))
+ if (separate_debug_file_exists (debugfile, crc32, objfile->name))
{
xfree (basename);
xfree (dir);
@@ -1408,7 +1419,7 @@ find_separate_debug_file (struct objfile
strcat (debugfile, "/");
strcat (debugfile, basename);
- if (separate_debug_file_exists (debugfile, crc32))
+ if (separate_debug_file_exists (debugfile, crc32, objfile->name))
{
xfree (basename);
xfree (dir);
@@ -1421,7 +1432,7 @@ find_separate_debug_file (struct objfile
strcat (debugfile, dir);
strcat (debugfile, basename);
- if (separate_debug_file_exists (debugfile, crc32))
+ if (separate_debug_file_exists (debugfile, crc32, objfile->name))
{
xfree (basename);
xfree (dir);
@@ -1440,7 +1451,7 @@ find_separate_debug_file (struct objfile
strcat (debugfile, "/");
strcat (debugfile, basename);
- if (separate_debug_file_exists (debugfile, crc32))
+ if (separate_debug_file_exists (debugfile, crc32, objfile->name))
{
xfree (canon_name);
xfree (basename);

View File

@ -129,7 +129,7 @@ Index: gdb/testsuite/ChangeLog
+}
--- gdb-6.3/gdb/testsuite/gdb.cp/constructortest.exp.fix Fri Jan 21 17:07:02 2005
+++ gdb-6.3/gdb/testsuite/gdb.cp/constructortest.exp Fri Jan 21 17:05:29 2005
@@ -0,0 +1,131 @@
@@ -0,0 +1,137 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2005, 2007 Free Software Foundation, Inc.
@ -179,8 +179,9 @@ Index: gdb/testsuite/ChangeLog
+ gdb_suppress_tests
+}
+
+# Break on the various forms of the A::A constructor
+gdb_test "break A\:\:A" "Breakpoint 2 at .* \\(2 locations\\)" "breaking on A::A"
+# Break on the various forms of the A::A constructor.
+# " (2 locations)" is displayed depending on G++ version.
+gdb_test "break A\:\:A" "Breakpoint 2 at .*" "breaking on A::A"
+
+# Verify that we break for the A constructor two times
+# Once for new A and once for new B
@ -206,7 +207,8 @@ Index: gdb/testsuite/ChangeLog
+gdb_test "break 'A::A()'" "" "break in constructor A 2"
+gdb_continue_to_breakpoint "First line A"
+set second_line [gdb_get_line_number "Second line A"]
+gdb_test "break $second_line" "Breakpoint .*, line $second_line. \\(2 locations\\)" "break by line in constructor"
+# " (2 locations)" is displayed depending on G++ version.
+gdb_test "break $second_line" "Breakpoint .*, line $second_line\\..*" "break by line in constructor"
+gdb_continue_to_breakpoint "Second line A"
+gdb_test "bt" "#0.*A.*#1.*main.*" "Verify in in-charge A::A second line"
+gdb_continue_to_breakpoint "Second line A"
@ -217,7 +219,8 @@ Index: gdb/testsuite/ChangeLog
+gdb_test "break 'A::~A()'" "" "break in constructor ~A 2"
+gdb_continue_to_breakpoint "First line ~A"
+set second_line_dtor [gdb_get_line_number "Second line ~A"]
+gdb_test "break $second_line_dtor" "Breakpoint .*, line $second_line_dtor. \\(2 locations\\)" "break by line in destructor"
+# " (2 locations)" is displayed depending on G++ version.
+gdb_test "break $second_line_dtor" "Breakpoint .*, line $second_line_dtor\\..*" "break by line in destructor"
+gdb_continue_to_breakpoint "Second line ~A"
+gdb_test "bt" "#0.*A.*#1.*main.*" "Verify in in-charge A::~A second line"
+# FIXME: Analyse this case better.
@ -232,8 +235,11 @@ Index: gdb/testsuite/ChangeLog
+gdb_load ${binfile}
+runto_main
+
+set first_line_dtor [gdb_get_line_number "First line ~C"]
+set define_line_dtor [gdb_get_line_number "Destructor C"]
+# Break on the various forms of the C::~C destructor
+gdb_test "break C\:\:~C" "Breakpoint .* \\(3 locations\\)" "breaking on C::~C"
+# " ([23] locations)" is displayed depending on G++ version.
+gdb_test "break C\:\:~C" "Breakpoint .*, line ($define_line_dtor|$define_line_dtor)\\..*" "breaking on C::~C"
+gdb_continue_to_breakpoint "First line ~C"
+
+# Verify that we can break by line number in a destructor and find
@ -242,8 +248,8 @@ Index: gdb/testsuite/ChangeLog
+gdb_load ${binfile}
+delete_breakpoints
+
+set first_line_dtor [gdb_get_line_number "First line ~C"]
+gdb_test "break $first_line_dtor" "Breakpoint .*, line $first_line_dtor. \\(3 locations\\)" "break by line in destructor"
+# " (3 locations)" is displayed depending on G++ version.
+gdb_test "break $first_line_dtor" "Breakpoint .*, line $first_line_dtor\\..*" "break by line in destructor"
+
+# Run to `main' where we begin our tests.
+# Set the breakpoints first to test PIE multiple-PC BREAKPOINT_RE_SET.

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

@ -1,55 +0,0 @@
Index: gdb-6.8/gdb/testsuite/gdb.base/sepdebug.exp
===================================================================
--- gdb-6.8.orig/gdb/testsuite/gdb.base/sepdebug.exp 2008-02-26 09:14:11.000000000 +0100
+++ gdb-6.8/gdb/testsuite/gdb.base/sepdebug.exp 2008-07-14 10:26:19.000000000 +0200
@@ -981,3 +981,40 @@ if ![string compare $build_id_debug_file
# Spare debug files may confuse testsuite runs in the future.
remote_exec build "rm -f ${objdir}/${subdir}/${build_id_debug_filename}"
}
+
+
+# Compile up a second, different, object file. Copy its debug info
+# over the top of the new debug info. Note that somewhere in the
+# above the "set debug-file-directory" variable is set to
+# ${objdir}/${subdir} so need to move things there.
+
+set existing_binfile $binfile
+set testfile "sepdebug2"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+set corrupt_debug_file [separate_debug_filename $binfile]
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } {
+ return -1
+}
+if [gdb_gnu_strip_debug $binfile] {
+ # check that you have a recent version of strip and objcopy installed
+ unsupported "cannot produce separate debug info files"
+ return -1
+}
+remote_exec build "cp $corrupt_debug_file ${existing_binfile}.debug"
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+set test "A corrupt debug file gets a warning"
+gdb_test_multiple "file $existing_binfile" "$test" {
+ -re "warning:.*mismatch.*" {
+ pass "$test"
+ }
+ -re ".y or n. " {
+ send_gdb "y\n"
+ exp_continue
+ }
+}
Index: gdb-6.8/gdb/testsuite/gdb.base/sepdebug2.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.8/gdb/testsuite/gdb.base/sepdebug2.c 2008-07-14 10:26:19.000000000 +0200
@@ -0,0 +1,5 @@
+int
+main (int argc, char *argv[], char *envp[])
+{
+ return 0;
+}

View File

@ -1,128 +0,0 @@
--- /dev/null 2008-04-03 00:39:30.714021604 +0200
+++ gdb-6.3/gdb/testsuite/gdb.base/watchpoint-cond-gone-stripped.c 2008-04-05 20:26:29.000000000 +0200
@@ -0,0 +1,23 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2008 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. */
+
+void
+jumper (void (*jumpto) (void))
+{
+ (*jumpto) ();
+}
--- /dev/null 2008-04-03 00:39:30.714021604 +0200
+++ gdb-6.3/gdb/testsuite/gdb.base/watchpoint-cond-gone.c 2008-04-05 20:26:48.000000000 +0200
@@ -0,0 +1,37 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2008 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. */
+
+extern void jumper (void (*jumpto) (void));
+
+void
+func ()
+{
+ int a, b, c;
+
+ a = b = c = 5;
+ a = b = c = 10; /* watchpoint-here */
+ c = a + b;
+}
+
+int
+main ()
+{
+ jumper (func);
+
+ return 0;
+}
--- /dev/null 2008-04-03 00:39:30.714021604 +0200
+++ gdb-6.3/gdb/testsuite/gdb.base/watchpoint-cond-gone.exp 2008-04-05 20:33:19.000000000 +0200
@@ -0,0 +1,59 @@
+# Copyright 2008 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 testfile "watchpoint-cond-gone"
+set srcfile ${testfile}.c
+set srcfilestripped ${testfile}-stripped.c
+set objfilestripped ${objdir}/${subdir}/${testfile}-stripped.o
+set binfile ${objdir}/${subdir}/${testfile}
+
+# We need to generate a function without DWARF to crash older GDB.
+# Stepping into a dynamic function trampoline or stepping out of MAIN may work
+# but it is not a reliable FAIL case.
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfilestripped}" "${objfilestripped}" object {}] != "" } {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${objfilestripped}" "${binfile}" executable {debug}] != "" } {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+# Problem does not occur otherwise.
+gdb_test "set can-use-hw-watchpoints 0"
+
+runto_main
+gdb_breakpoint [gdb_get_line_number "watchpoint-here"]
+gdb_continue_to_breakpoint "Place to set the watchpoint"
+
+# The condition `c == 30' is the tested culprit.
+gdb_test "watch c if c == 30" "" "Place the watchpoint"
+
+# No functionality, just to check the state.
+gdb_test "backtrace"
+
+gdb_test "finish" \
+ "Watchpoint .* deleted because the program has left the block in.*which its expression is valid..*in (jumper|func).*" \
+ "Catch the no longer valid watchpoint"

View File

@ -162,6 +162,155 @@ Index: gdb-6.8.50.20090802/gdb/amd64-tdep.c
};
/* Floating-point registers. */
--- a/gdb/ia64-tdep.c
+++ b/gdb/ia64-tdep.c
@@ -2122,6 +2122,138 @@ static const struct frame_unwind ia64_frame_unwind =
default_frame_sniffer
};
+/* Detect the outermost frame; during unwind of
+ #6 0x2000000000347100 in __clone2 () from /lib/libc.so.6.1
+ avoid the additional bogus frame
+ #7 0x0000000000000000 in ?? () */
+
+static char linux_clone2_code[] =
+{
+/* libc/sysdeps/unix/sysv/linux/ia64/clone2.S */
+ 0x09, 0x00, 0x20, 0x12, 0x90, 0x11, 0x00, 0x40,
+ 0x28, 0x20, 0x23, 0x00, 0x00, 0x00, 0x04, 0x00,
+/* st4 [r9]=r8 */
+/* st4 [r10]=r8 */
+/* ;; */
+/* #endif */
+ 0x02, 0x50, 0x21, 0x40, 0x18, 0x14, 0x90, 0x02,
+ 0x90, 0x00, 0x42, 0x00, 0x00, 0x00, 0x04, 0x00,
+/* 1: ld8 out1=[in0],8 |* Retrieve code pointer. *| */
+/* mov out0=in4 |* Pass proper argument to fn *| */
+/* ;; */
+ 0x11, 0x08, 0x00, 0x40, 0x18, 0x10, 0x60, 0x50,
+ 0x05, 0x80, 0x03, 0x00, 0x68, 0x00, 0x80, 0x12,
+/* ld8 gp=[in0] |* Load function gp. *| */
+/* mov b6=out1 */
+/* br.call.dptk.many rp=b6 |* Call fn(arg) in the child *| */
+/* ;; */
+ 0x10, 0x48, 0x01, 0x10, 0x00, 0x21, 0x10, 0x00,
+ 0xa0, 0x00, 0x42, 0x00, 0x98, 0xdf, 0xf7, 0x5b,
+/* mov out0=r8 |* Argument to _exit *| */
+/* mov gp=loc0 */
+/* .globl HIDDEN_JUMPTARGET(_exit) */
+/* br.call.dpnt.many rp=HIDDEN_JUMPTARGET(_exit) */
+/* |* call _exit with result from fn. *| */
+ 0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x02, 0x00, 0x80, 0x00, 0x00, 0x84, 0x00
+/* ret |* Not reached. *| */
+};
+
+#define LINUX_CLONE_PRE_SLOTS 3 /* Number of slots before PC. */
+#define LINUX_CLONE_LEN (sizeof linux_clone2_code)
+
+static int
+ia64_linux_clone2_running (struct frame_info *this_frame)
+{
+ CORE_ADDR pc = get_frame_pc (this_frame);
+ char buf[LINUX_CLONE_LEN];
+ struct minimal_symbol *minsym;
+ long long instr;
+
+ if (!safe_frame_unwind_memory (this_frame, pc - LINUX_CLONE_PRE_SLOTS * 16,
+ buf, LINUX_CLONE_LEN))
+ return 0;
+
+ if (memcmp (buf, linux_clone2_code, LINUX_CLONE_PRE_SLOTS * 16) != 0)
+ return 0;
+
+ /* Adjust the expected "_exit" address. */
+ minsym = lookup_minimal_symbol_text ("_exit", NULL);
+ if (minsym == NULL)
+ return 0;
+
+ instr = slotN_contents (&linux_clone2_code[LINUX_CLONE_PRE_SLOTS * 16], 2);
+ instr &= ~(((1L << 20) - 1) << 13);
+ /* Address is relative to the jump instruction slot, not the next one. */
+ instr |= (((SYMBOL_VALUE_ADDRESS (minsym) - (pc & ~0xfL)) >> 4)
+ & ((1L << 20) - 1)) << 13;
+ replace_slotN_contents (&linux_clone2_code[LINUX_CLONE_PRE_SLOTS * 16], instr,
+ 2);
+
+ if (memcmp (&buf[LINUX_CLONE_PRE_SLOTS * 16],
+ &linux_clone2_code[LINUX_CLONE_PRE_SLOTS * 16],
+ LINUX_CLONE_LEN - (LINUX_CLONE_PRE_SLOTS * 16)) != 0)
+ return 0;
+
+ return 1;
+}
+
+static int
+ia64_outermost_frame (struct frame_info *this_frame)
+{
+ CORE_ADDR pc = get_frame_pc (this_frame);
+ char *name;
+
+ find_pc_partial_function (pc, &name, NULL, NULL);
+
+ /* If we have NAME, we can optimize the search.
+ `clone' NAME still needs to have the code checked as its name may be
+ present in the user code.
+ `__clone' NAME should not be present in the user code but in the initial
+ parts of the `__clone' implementation the unwind still makes sense.
+ More detailed unwinding decision would be too much sensitive to possible
+ subtle changes in specific glibc revisions. */
+ if (name == NULL || strcmp (name, "clone2") == 0
+ || strcmp ("__clone2", name) == 0)
+ return (ia64_linux_clone2_running (this_frame) != 0);
+
+ return 0;
+}
+
+static void
+ia64_clone2_frame_this_id (struct frame_info *this_frame, void **this_cache,
+ struct frame_id *this_id)
+{
+ /* Leave the default outermost frame at *THIS_ID. */
+}
+
+static struct value *
+ia64_clone2_frame_prev_register (struct frame_info *this_frame,
+ void **this_cache, int regnum)
+{
+ return frame_unwind_got_register (this_frame, regnum, regnum);
+}
+
+static int
+ia64_clone2_frame_sniffer (const struct frame_unwind *self,
+ struct frame_info *this_frame,
+ void **this_prologue_cache)
+{
+ if (ia64_outermost_frame (this_frame))
+ return 1;
+
+ return 0;
+}
+
+static const struct frame_unwind ia64_clone2_frame_unwind =
+{
+ NORMAL_FRAME,
+ &ia64_clone2_frame_this_id,
+ &ia64_clone2_frame_prev_register,
+ NULL,
+ &ia64_clone2_frame_sniffer
+};
+
/* Signal trampolines. */
static void
@@ -3824,6 +3955,7 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_dummy_id (gdbarch, ia64_dummy_id);
set_gdbarch_unwind_pc (gdbarch, ia64_unwind_pc);
+ frame_unwind_append_unwinder (gdbarch, &ia64_clone2_frame_unwind);
#ifdef HAVE_LIBUNWIND_IA64_H
frame_unwind_append_unwinder (gdbarch,
&ia64_libunwind_sigtramp_frame_unwind);
Index: gdb-6.8.50.20090802/gdb/testsuite/gdb.threads/bt-clone-stop.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000

View File

@ -1,19 +0,0 @@
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=218379
Index: gdb-6.8.50.20081128/gdb/minsyms.c
===================================================================
--- gdb-6.8.50.20081128.orig/gdb/minsyms.c 2008-10-01 18:56:52.000000000 +0200
+++ gdb-6.8.50.20081128/gdb/minsyms.c 2008-12-02 23:24:27.000000000 +0100
@@ -544,6 +544,11 @@ lookup_minimal_symbol_by_pc_section_1 (C
don't fill the bfd_section member, so don't
throw away symbols on those platforms. */
&& SYMBOL_OBJ_SECTION (&msymbol[hi]) != NULL
+ /* Don't ignore symbols for solib trampolines.
+ Limit its sideeffects - only for non-0 sized trampolines.
+ Red Hat Bug 200533 with its regression Bug 218379. */
+ && (MSYMBOL_TYPE (&msymbol[hi]) != mst_solib_trampoline
+ || MSYMBOL_SIZE (&msymbol[hi]))
&& (!matching_obj_sections
(SYMBOL_OBJ_SECTION (&msymbol[hi]), section)))
{

View File

@ -48,7 +48,7 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c
int (*deprecated_ui_load_progress_hook) (const char *section, unsigned long num);
@@ -1673,8 +1675,352 @@ build_id_to_filename (struct build_id *b
@@ -1673,8 +1675,353 @@ build_id_to_filename (struct build_id *b
return retval;
}
@ -258,7 +258,8 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c
+
+ /* Base package name for `debuginfo-install'. We do not use the
+ `yum' command directly as the line
+ yum --enablerepo='*-debuginfo' install NAME-debuginfo.ARCH
+ yum --disablerepo='*' --enablerepo='*-debuginfo' \
+ install NAME-debuginfo.ARCH
+ would be more complicated than just:
+ debuginfo-install NAME-VERSION-RELEASE.ARCH
+ Do not supply the rpm base name (derived from .src.rpm name) as
@ -398,7 +399,7 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c
+
/* This MISSING_FILEPAIR_HASH tracker is used only for the duplicite messages
- Try to install the hash file ...
+ yum --enablerepo='*-debuginfo' install ...
+ yum --disablerepo='*' --enablerepo='*-debuginfo' install ...
avoidance. */
struct missing_filepair
@ -420,7 +421,7 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c
missing_filepair_change ();
}
@@ -1799,14 +2151,33 @@ debug_print_missing (const char *binary,
@@ -1799,14 +2151,34 @@ debug_print_missing (const char *binary,
*slot = missing_filepair;
@ -456,7 +457,8 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c
+ _("Missing separate debuginfo for %s\n"), binary);
+ if (debug != NULL)
+ fprintf_unfiltered (gdb_stdlog, _("Try: %s %s\n"),
+ "yum --enablerepo='*-debuginfo' install", debug);
+ "yum --disablerepo='*' --enablerepo='*-debuginfo'"
+ " install", debug);
+ }
}

View File

@ -1,7 +1,7 @@
Index: gdb-6.8.91.20090925/gdb/corelow.c
Index: gdb-7.0/gdb/corelow.c
===================================================================
--- gdb-6.8.91.20090925.orig/gdb/corelow.c 2009-07-31 17:25:21.000000000 +0200
+++ gdb-6.8.91.20090925/gdb/corelow.c 2009-09-25 09:39:09.000000000 +0200
--- gdb-7.0.orig/gdb/corelow.c 2009-07-31 17:25:21.000000000 +0200
+++ gdb-7.0/gdb/corelow.c 2009-10-23 00:17:29.000000000 +0200
@@ -45,6 +45,10 @@
#include "exceptions.h"
#include "solib.h"
@ -91,11 +91,11 @@ Index: gdb-6.8.91.20090925/gdb/corelow.c
+ NULL, NULL, NULL,
+ &setlist, &showlist);
}
Index: gdb-6.8.91.20090925/gdb/doc/gdb.texinfo
Index: gdb-7.0/gdb/doc/gdb.texinfo
===================================================================
--- gdb-6.8.91.20090925.orig/gdb/doc/gdb.texinfo 2009-09-25 09:29:58.000000000 +0200
+++ gdb-6.8.91.20090925/gdb/doc/gdb.texinfo 2009-09-25 09:29:58.000000000 +0200
@@ -13895,6 +13895,27 @@ information files.
--- gdb-7.0.orig/gdb/doc/gdb.texinfo 2009-10-23 00:12:39.000000000 +0200
+++ gdb-7.0/gdb/doc/gdb.texinfo 2009-10-23 00:17:29.000000000 +0200
@@ -13896,6 +13896,27 @@ information files.
@end table
@ -123,10 +123,10 @@ Index: gdb-6.8.91.20090925/gdb/doc/gdb.texinfo
@cindex @code{.gnu_debuglink} sections
@cindex debug link sections
A debug link is a special section of the executable file named
Index: gdb-6.8.91.20090925/gdb/solib-svr4.c
Index: gdb-7.0/gdb/solib-svr4.c
===================================================================
--- gdb-6.8.91.20090925.orig/gdb/solib-svr4.c 2009-09-25 09:29:57.000000000 +0200
+++ gdb-6.8.91.20090925/gdb/solib-svr4.c 2009-09-25 09:43:14.000000000 +0200
--- gdb-7.0.orig/gdb/solib-svr4.c 2009-10-23 00:12:38.000000000 +0200
+++ gdb-7.0/gdb/solib-svr4.c 2009-10-23 00:17:29.000000000 +0200
@@ -1101,9 +1101,49 @@ svr4_current_sos (void)
safe_strerror (errcode));
else
@ -180,10 +180,10 @@ Index: gdb-6.8.91.20090925/gdb/solib-svr4.c
}
xfree (buffer);
Index: gdb-6.8.91.20090925/gdb/symfile.c
Index: gdb-7.0/gdb/symfile.c
===================================================================
--- gdb-6.8.91.20090925.orig/gdb/symfile.c 2009-09-25 09:29:57.000000000 +0200
+++ gdb-6.8.91.20090925/gdb/symfile.c 2009-09-25 09:29:58.000000000 +0200
--- gdb-7.0.orig/gdb/symfile.c 2009-10-23 00:12:38.000000000 +0200
+++ gdb-7.0/gdb/symfile.c 2009-10-23 00:43:28.000000000 +0200
@@ -56,6 +56,7 @@
#include "elf-bfd.h"
#include "solib.h"
@ -618,7 +618,7 @@ Index: gdb-6.8.91.20090925/gdb/symfile.c
if (found == NULL)
warning (_("File \"%s\" has no build-id, file skipped"), filename);
@@ -1234,8 +1626,9 @@ build_id_verify (const char *filename, s
@@ -1234,14 +1626,16 @@ build_id_verify (const char *filename, s
return retval;
}
@ -628,48 +628,77 @@ Index: gdb-6.8.91.20090925/gdb/symfile.c
+build_id_to_filename (struct build_id *build_id, char **link_return,
+ int add_debug_suffix)
{
char *link, *s, *retval = NULL;
gdb_byte *data = build_id->data;
@@ -1243,7 +1636,9 @@ build_id_to_debug_filename (struct build
char *link, *debugdir, *retval = NULL;
+ char *link_all = NULL;
/* DEBUG_FILE_DIRECTORY/.build-id/ab/cdef */
link = xmalloc (strlen (debug_file_directory) + (sizeof "/.build-id/" - 1) + 1
- + 2 * size + (sizeof ".debug" - 1) + 1);
+ + 2 * size
+ + (add_debug_suffix ? sizeof ".debug" - 1 : 0)
+ + 1);
s = link + sprintf (link, "%s/.build-id/", debug_file_directory);
if (size > 0)
{
@@ -1254,12 +1649,14 @@ build_id_to_debug_filename (struct build
*s++ = '/';
while (size-- > 0)
s += sprintf (s, "%02x", (unsigned) *data++);
- strcpy (s, ".debug");
+ if (add_debug_suffix)
+ strcpy (s, ".debug");
+ else
+ *s = 0;
- link = alloca (strlen (debug_file_directory) + (sizeof "/.build-id/" - 1) + 1
- + 2 * build_id->size + (sizeof ".debug" - 1) + 1);
+ link = xmalloc (strlen (debug_file_directory) + (sizeof "/.build-id/" - 1) + 1
+ + 2 * build_id->size + (sizeof ".debug" - 1) + 1);
/* lrealpath() is expensive even for the usually non-existent files. */
if (access (link, F_OK) == 0)
retval = lrealpath (link);
- xfree (link);
/* Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will
cause "/.build-id/..." lookups. */
@@ -1272,7 +1666,10 @@ build_id_to_debug_filename (struct build
*s++ = '/';
while (size-- > 0)
s += sprintf (s, "%02x", (unsigned) *data++);
- strcpy (s, ".debug");
+ if (add_debug_suffix)
+ strcpy (s, ".debug");
+ else
+ *s = 0;
if (retval != NULL && !build_id_verify (retval, build_id))
{
@@ -1267,9 +1664,150 @@ build_id_to_debug_filename (struct build
retval = NULL;
/* lrealpath() is expensive even for the usually non-existent files. */
if (access (link, F_OK) == 0)
@@ -1285,15 +1682,185 @@ build_id_to_debug_filename (struct build
}
if (retval != NULL)
- break;
+ {
+ /* LINK_ALL is not used below in this non-NULL RETVAL case. */
+ break;
+ }
+
+ if (link_all == NULL)
+ link_all = xstrdup (link);
+ else
+ {
+ size_t len_orig = strlen (link_all);
+
+ link_all = xrealloc (link_all, len_orig + 1 + strlen (link) + 1);
+
+ /* Use whitespace instead of DIRNAME_SEPARATOR to be compatible with
+ its possible use as an argument for installation command. */
+ link_all[len_orig] = ' ';
+
+ strcpy (&link_all[len_orig + 1], link);
+ }
debugdir = debugdir_end;
}
while (*debugdir != 0);
+ if (link_return != NULL)
+ *link_return = link;
+ else
+ xfree (link);
+ {
+ if (retval != NULL)
+ {
+ *link_return = link;
+ link = NULL;
+ }
+ else
+ {
+ *link_return = link_all;
+ link_all = NULL;
+ }
+ }
+ xfree (link);
+ xfree (link_all);
+
+ return retval;
+}
+
return retval;
}
+/* This MISSING_FILEPAIR_HASH tracker is used only for the duplicite messages
+ Try to install the hash file ...
+ avoidance. */
@ -692,9 +721,9 @@ Index: gdb-6.8.91.20090925/gdb/symfile.c
+
+ retval = obstack_alloc (&missing_filepair_obstack, size);
+ memset (retval, 0, size);
+ return retval;
+}
+
return retval;
}
+static hashval_t
+missing_filepair_hash_func (const struct missing_filepair *elem)
+{
@ -809,20 +838,7 @@ Index: gdb-6.8.91.20090925/gdb/symfile.c
static char *
get_debug_link_info (struct objfile *objfile, unsigned long *crc32_out)
{
@@ -1352,32 +1890,36 @@ static char *
find_separate_debug_file (struct objfile *objfile)
{
asection *sect;
- char *basename;
- char *dir;
- char *debugfile;
+ char *basename = NULL;
+ char *dir = NULL;
+ char *debugfile = NULL;
char *name_copy;
- char *canon_name;
+ char *canon_name = NULL;
bfd_size_type debuglink_size;
@@ -1384,13 +1951,14 @@ find_separate_debug_file (struct objfile
unsigned long crc32;
int i;
struct build_id *build_id;
@ -839,123 +855,34 @@ Index: gdb-6.8.91.20090925/gdb/symfile.c
xfree (build_id);
/* Prevent looping on a stripped .debug file. */
if (build_id_name != NULL && strcmp (build_id_name, objfile->name) == 0)
{
- warning (_("\"%s\": separate debug info file has no debug info"),
+ warning (_("\"%s\": The separate debug info file has no debug info"),
build_id_name);
@@ -1400,7 +1968,10 @@ find_separate_debug_file (struct objfile
xfree (build_id_name);
}
else if (build_id_name != NULL)
- return build_id_name;
+ {
+ {
+ xfree (build_id_filename);
+ return build_id_name;
+ }
}
basename = get_debug_link_info (objfile, &crc32);
@@ -1385,7 +1927,7 @@ find_separate_debug_file (struct objfile
if (basename == NULL)
/* There's no separate debug info, hence there's no way we could
load it => no warning. */
- return NULL;
+ goto cleanup_return_debugfile;
dir = xstrdup (objfile->name);
@@ -1407,24 +1949,19 @@ find_separate_debug_file (struct objfile
if (canon_name && strlen (canon_name) > i)
i = strlen (canon_name);
- debugfile = alloca (strlen (debug_file_directory) + 1
- + i
- + strlen (DEBUG_SUBDIRECTORY)
- + strlen ("/")
- + strlen (basename)
- + 1);
+ debugfile = xmalloc (strlen (debug_file_directory) + 1
+ + i
+ + strlen (DEBUG_SUBDIRECTORY)
+ + strlen ("/")
+ + strlen (basename)
+ + 1);
/* First try in the same directory as the original file. */
strcpy (debugfile, dir);
strcat (debugfile, basename);
if (separate_debug_file_exists (debugfile, crc32, objfile->name))
- {
- xfree (basename);
- xfree (dir);
- xfree (canon_name);
- return xstrdup (debugfile);
- }
+ goto cleanup_return_debugfile;
/* Then try in the subdirectory named DEBUG_SUBDIRECTORY. */
strcpy (debugfile, dir);
@@ -1433,12 +1970,7 @@ find_separate_debug_file (struct objfile
strcat (debugfile, basename);
if (separate_debug_file_exists (debugfile, crc32, objfile->name))
- {
- xfree (basename);
- xfree (dir);
- xfree (canon_name);
- return xstrdup (debugfile);
- }
+ goto cleanup_return_debugfile;
/* Then try in the global debugfile directory. */
strcpy (debugfile, debug_file_directory);
@@ -1447,12 +1979,7 @@ find_separate_debug_file (struct objfile
strcat (debugfile, basename);
if (separate_debug_file_exists (debugfile, crc32, objfile->name))
- {
- xfree (basename);
- xfree (dir);
- xfree (canon_name);
- return xstrdup (debugfile);
- }
+ goto cleanup_return_debugfile;
/* If the file is in the sysroot, try using its base path in the
global debugfile directory. */
@@ -1466,20 +1993,18 @@ find_separate_debug_file (struct objfile
strcat (debugfile, basename);
if (separate_debug_file_exists (debugfile, crc32, objfile->name))
- {
- xfree (canon_name);
- xfree (basename);
- xfree (dir);
- return xstrdup (debugfile);
- }
+ goto cleanup_return_debugfile;
}
@@ -1501,8 +2072,10 @@ find_separate_debug_file (struct objfile
- if (canon_name)
- xfree (canon_name);
+ debugfile = NULL;
xfree (debugfile);
debugfile = NULL;
+ debug_print_missing (objfile->name, build_id_filename);
+cleanup_return_debugfile:
cleanup_return_debugfile:
+ xfree (build_id_filename);
+ xfree (canon_name);
xfree (canon_name);
xfree (basename);
xfree (dir);
- return NULL;
+ return debugfile;
}
@@ -4229,4 +4754,16 @@ the global debug-file directory prepende
@@ -4256,4 +4829,16 @@ each global debug-file-directory compone
NULL,
show_debug_file_directory,
&setlist, &showlist);
+
+
+ add_setshow_zinteger_cmd ("build-id-verbose", no_class, &build_id_verbose,
+ _("\
+ Set debugging level of the build-id locator."), _("\
@ -965,13 +892,13 @@ Index: gdb-6.8.91.20090925/gdb/symfile.c
+ NULL,
+ show_build_id_verbose,
+ &setlist, &showlist);
+
+
+ observer_attach_executable_changed (debug_print_executable_changed);
}
Index: gdb-6.8.91.20090925/gdb/symfile.h
Index: gdb-7.0/gdb/symfile.h
===================================================================
--- gdb-6.8.91.20090925.orig/gdb/symfile.h 2009-09-25 09:29:57.000000000 +0200
+++ gdb-6.8.91.20090925/gdb/symfile.h 2009-09-25 09:29:58.000000000 +0200
--- gdb-7.0.orig/gdb/symfile.h 2009-10-23 00:12:38.000000000 +0200
+++ gdb-7.0/gdb/symfile.h 2009-10-23 00:17:29.000000000 +0200
@@ -381,6 +381,13 @@ extern int symfile_map_offsets_to_segmen
struct symfile_segment_data *get_symfile_segment_data (bfd *abfd);
void free_symfile_segment_data (struct symfile_segment_data *data);
@ -986,10 +913,10 @@ Index: gdb-6.8.91.20090925/gdb/symfile.h
/* From dwarf2read.c */
extern int dwarf2_has_info (struct objfile *);
Index: gdb-6.8.91.20090925/gdb/testsuite/lib/gdb.exp
Index: gdb-7.0/gdb/testsuite/lib/gdb.exp
===================================================================
--- gdb-6.8.91.20090925.orig/gdb/testsuite/lib/gdb.exp 2009-09-25 09:29:57.000000000 +0200
+++ gdb-6.8.91.20090925/gdb/testsuite/lib/gdb.exp 2009-09-25 09:29:58.000000000 +0200
--- gdb-7.0.orig/gdb/testsuite/lib/gdb.exp 2009-10-23 00:12:38.000000000 +0200
+++ gdb-7.0/gdb/testsuite/lib/gdb.exp 2009-10-23 00:17:29.000000000 +0200
@@ -1248,6 +1248,16 @@ proc default_gdb_start { } {
warning "Couldn't set the width to 0."
}
@ -1007,10 +934,10 @@ Index: gdb-6.8.91.20090925/gdb/testsuite/lib/gdb.exp
return 0;
}
Index: gdb-6.8.91.20090925/gdb/testsuite/lib/mi-support.exp
Index: gdb-7.0/gdb/testsuite/lib/mi-support.exp
===================================================================
--- gdb-6.8.91.20090925.orig/gdb/testsuite/lib/mi-support.exp 2009-09-15 20:51:26.000000000 +0200
+++ gdb-6.8.91.20090925/gdb/testsuite/lib/mi-support.exp 2009-09-25 09:29:58.000000000 +0200
--- gdb-7.0.orig/gdb/testsuite/lib/mi-support.exp 2009-09-15 20:51:26.000000000 +0200
+++ gdb-7.0/gdb/testsuite/lib/mi-support.exp 2009-10-23 00:17:29.000000000 +0200
@@ -221,6 +221,16 @@ proc default_mi_gdb_start { args } {
}
}
@ -1028,10 +955,10 @@ Index: gdb-6.8.91.20090925/gdb/testsuite/lib/mi-support.exp
detect_async
Index: gdb-6.8.91.20090925/gdb/objfiles.h
Index: gdb-7.0/gdb/objfiles.h
===================================================================
--- gdb-6.8.91.20090925.orig/gdb/objfiles.h 2009-09-25 09:29:57.000000000 +0200
+++ gdb-6.8.91.20090925/gdb/objfiles.h 2009-09-25 09:38:27.000000000 +0200
--- gdb-7.0.orig/gdb/objfiles.h 2009-10-23 00:12:38.000000000 +0200
+++ gdb-7.0/gdb/objfiles.h 2009-10-23 00:17:29.000000000 +0200
@@ -428,6 +428,10 @@ struct objfile
#define OBJF_MAIN (1 << 7)

View File

@ -102,17 +102,154 @@ frames-invalid can happen asynchronously.
set timeout $oldtimeout
return 0
--- sources/gdb/testsuite/gdb.base/dump.exp-orig 2008-08-28 11:44:40.000000000 +0200
+++ sources/gdb/testsuite/gdb.base/dump.exp 2008-08-28 11:44:49.000000000 +0200
@@ -493,8 +493,10 @@ if ![string compare $is64bitonly "no"] t
gdb_test "print zero_all ()" "" ""
http://sourceware.org/ml/gdb-patches/2009-12/msg00234.html
Subject: [patch] testsuite: Fix a race by me - watchthreads-reorder.exp
Hi,
there is a bug explainable by man pthread_cond_signal:
The [...] pthread_cond_signal() functions shall have no effect if
there are no threads currently blocked on cond.
meaning a race for the testcase.
+FAIL: gdb.threads/watchthreads-reorder.exp: reorder1: continue a (timeout)
One can reproduce the race on CVS HEAD by:
# --- a/gdb/testsuite/gdb.threads/watchthreads-reorder.c
# +++ b/gdb/testsuite/gdb.threads/watchthreads-reorder.c
# @@ -89,6 +89,7 @@ thread1_func (void *unused)
# int i;
# volatile int rwatch_store;
#
# +sleep(1);
# thread1_tid = gettid ();
# i = pthread_cond_signal (&thread1_tid_cond);
# assert (i == 0);
# @@ -317,6 +318,7 @@ main (int argc, char **argv)
#
# if (thread1_tid == 0)
# {
# +sleep(2);
# i = pthread_cond_wait (&thread1_tid_cond, &thread1_tid_mutex);
# assert (i == 0);
#
Fixed; gdbstop_mutex got removed as it became redundant there.
Going to check it in as obvious in several days (code is by me + it is just
a testcase).
Sorry,
Jan
gdb/testsuite/
2009-12-17 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.threads/watchthreads-reorder.c (gdbstop_mutex): Remove.
(thread1_func): Protect thread1_tid_cond by thread1_tid_mutex. Remove
gdbstop_mutex handling.
(thread2_func): Protect thread2_tid_cond by thread2_tid_mutex. Remove
gdbstop_mutex handling.
(main): Move thread1_tid_mutex and thread2_tid_mutex locks before
pthread_create. Remove gdbstop_mutex handling. New comment. Remove
pthread_cond_wait conditionalizations.
--- a/gdb/testsuite/gdb.threads/watchthreads-reorder.c
+++ b/gdb/testsuite/gdb.threads/watchthreads-reorder.c
@@ -34,8 +34,6 @@
otherwise. */
#define TIMEOUT (gettid () == getpid() ? 10 : 15)
# restore with expressions
+ # Address may fit in int32 but its negative result would be 0xffffxxxx for
+ # 64-bit LONGEST addresses.
test_restore_saved_value \
- "intarr3.srec ${array2_start}-${array_start} &intarray\[3\] &intarray\[4\]" \
+ "intarr3.srec (long)${array2_start}-${array_start} &intarray\[3\] &intarray\[4\]" \
"array partial with expressions" 4 "intarray2\[3\]"
-static pthread_mutex_t gdbstop_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
-
static pid_t thread1_tid;
static pthread_cond_t thread1_tid_cond = PTHREAD_COND_INITIALIZER;
static pthread_mutex_t thread1_tid_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
@@ -90,12 +88,11 @@ thread1_func (void *unused)
volatile int rwatch_store;
gdb_test "print intarray2\[2\] == 0" " = 1" "element 2 not changed, == 4"
thread1_tid = gettid ();
+
+ timed_mutex_lock (&thread1_tid_mutex);
i = pthread_cond_signal (&thread1_tid_cond);
assert (i == 0);
-
- /* Be sure GDB is already stopped before continuing. */
- timed_mutex_lock (&gdbstop_mutex);
- i = pthread_mutex_unlock (&gdbstop_mutex);
+ i = pthread_mutex_unlock (&thread1_tid_mutex);
assert (i == 0);
rwatch_store = thread1_rwatch;
@@ -115,12 +112,11 @@ thread2_func (void *unused)
volatile int rwatch_store;
thread2_tid = gettid ();
+
+ timed_mutex_lock (&thread2_tid_mutex);
i = pthread_cond_signal (&thread2_tid_cond);
assert (i == 0);
-
- /* Be sure GDB is already stopped before continuing. */
- timed_mutex_lock (&gdbstop_mutex);
- i = pthread_mutex_unlock (&gdbstop_mutex);
+ i = pthread_mutex_unlock (&thread2_tid_mutex);
assert (i == 0);
rwatch_store = thread2_rwatch;
@@ -267,7 +263,8 @@ main (int argc, char **argv)
setbuf (stdout, NULL);
- timed_mutex_lock (&gdbstop_mutex);
+ timed_mutex_lock (&thread1_tid_mutex);
+ timed_mutex_lock (&thread2_tid_mutex);
timed_mutex_lock (&terminate_mutex);
@@ -306,30 +303,21 @@ main (int argc, char **argv)
state_wait (tracer, "T (stopped)");
}
- timed_mutex_lock (&thread1_tid_mutex);
- timed_mutex_lock (&thread2_tid_mutex);
-
- /* Let the threads start. */
- i = pthread_mutex_unlock (&gdbstop_mutex);
- assert (i == 0);
+ /* Threads are now waiting at timed_mutex_lock (thread1_tid_mutex) and so
+ they could not trigger the watchpoints before GDB gets unstopped later.
+ Threads get resumed at pthread_cond_wait below. */
printf ("Waiting till the threads initialize their TIDs.\n");
- if (thread1_tid == 0)
- {
- i = pthread_cond_wait (&thread1_tid_cond, &thread1_tid_mutex);
- assert (i == 0);
+ i = pthread_cond_wait (&thread1_tid_cond, &thread1_tid_mutex);
+ assert (i == 0);
- assert (thread1_tid > 0);
- }
+ assert (thread1_tid > 0);
- if (thread2_tid == 0)
- {
- i = pthread_cond_wait (&thread2_tid_cond, &thread2_tid_mutex);
- assert (i == 0);
+ i = pthread_cond_wait (&thread2_tid_cond, &thread2_tid_mutex);
+ assert (i == 0);
- assert (thread2_tid > 0);
- }
+ assert (thread2_tid > 0);
printf ("Thread 1 TID = %lu, thread 2 TID = %lu, PID = %lu.\n",
(unsigned long) thread1_tid, (unsigned long) thread2_tid,

View File

@ -236,19 +236,19 @@ Index: gdb-6.8.91.20090917/gdb/breakpoint.c
{
int value_is_zero = 0;
@@ -3383,6 +3398,12 @@ bpstat_stop_status (CORE_ADDR bp_addr, p
bs->print = 0;
}
bs->commands = copy_command_lines (bs->commands);
@@ -3399,6 +3399,12 @@ bpstat_stop_status (CORE_ADDR bp_addr, p
bs->print = 0;
}
bs->commands = copy_command_lines (bs->commands);
+
+ /* Display the innermost inlined frame at a breakpont as it gives to
+ most of the available information. */
+ if (b->type != bp_until && b->type != bp_finish)
+ while (inline_skipped_frames (ptid))
+ step_into_inline_frame (ptid);
}
+ /* Display the innermost inlined frame at a breakpont as it gives to
+ most of the available information. */
+ if (b->type != bp_until && b->type != bp_finish)
+ while (inline_skipped_frames (ptid))
+ step_into_inline_frame (ptid);
}
/* Print nothing for this entry if we dont stop or if we dont print. */
/* Print nothing for this entry if we dont stop or if we dont print. */
@@ -5572,9 +5593,9 @@ set_momentary_breakpoint (struct gdbarch
{
struct breakpoint *b;

563
gdb-7.0-upstream.patch Normal file
View File

@ -0,0 +1,563 @@
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);
Re: [RFA] Fix "show convenience" test
http://sourceware.org/ml/gdb-patches/2009-09/msg00565.html
http://sourceware.org/ml/gdb-cvs/2009-09/msg00099.html
### src/gdb/testsuite/ChangeLog 2009/09/15 18:51:25 1.1960
### src/gdb/testsuite/ChangeLog 2009/09/17 17:49:46 1.1961
## -1,3 +1,7 @@
+2009-09-17 Paul Pluzhnikov <ppluzhnikov@google.com>
+
+ * gdb.base/default.exp: Fix "show convenience".
+
2009-09-15 Tom Tromey <tromey@redhat.com>
* lib/mi-support.exp (mi_create_varobj): Update.
--- src/gdb/testsuite/gdb.base/default.exp 2009/08/13 14:58:27 1.31
+++ src/gdb/testsuite/gdb.base/default.exp 2009/09/17 17:49:46 1.32
@@ -598,7 +598,7 @@
#test show confirm
gdb_test "show confirm" "Whether to confirm potentially dangerous operations is o\[a-z\]*." "show confirm"
#test show convenience
-gdb_test "show convenience" "No debugger convenience variables now defined.(\[^\r\n\]*\[\r\n\])+Convenience variables have names starting with \".\";(\[^\r\n\]*\[\r\n\])+use \"set\" as in \"set .foo = 5\" to define them." "show convenience"
+gdb_test "show convenience" "\\\$_siginfo = void" "show convenience"
#test show directories
gdb_test "show directories" "Source directories searched: .cdir\[:;\].cwd" "show directories"
#test show editing
### src/gdb/doc/ChangeLog 2009/09/15 18:51:24 1.953
### src/gdb/doc/ChangeLog 2009/09/17 17:49:46 1.954
## -1,3 +1,8 @@
+2009-09-17 Paul Pluzhnikov <ppluzhnikov@google.com>
+
+ * gdb.texinfo (convenince variables): Mention
+ $_siginfo could be empty.
+
2009-09-15 Tom Tromey <tromey@redhat.com>
* gdb.texinfo (GDB/MI Variable Objects): Document
--- src/gdb/doc/gdb.texinfo 2009/09/15 18:51:25 1.624
+++ src/gdb/doc/gdb.texinfo 2009/09/17 17:49:46 1.625
@@ -7819,8 +7819,10 @@
@item $_siginfo
@vindex $_siginfo@r{, convenience variable}
-The variable @code{$_siginfo} is bound to extra signal information
-inspection (@pxref{extra signal information}).
+The variable @code{$_siginfo} contains extra signal information
+(@pxref{extra signal information}). Note that @code{$_siginfo}
+could be empty, if the application has not yet received any signals.
+For example, it will be empty before you execute the @code{run} command.
@end table
On HP-UX systems, if you refer to a function or variable name that
http://sourceware.org/ml/gdb-cvs/2009-12/msg00128.html
### src/gdb/testsuite/ChangeLog 2009/12/23 23:18:08 1.2054
### src/gdb/testsuite/ChangeLog 2009/12/24 21:57:06 1.2055
## -1,3 +1,10 @@
+2009-12-24 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Fix compatibility with G++-4.5.
+ * gdb.cp/expand-sals.cc (main): Remove the "exit-line" comment.
+ * gdb.cp/expand-sals.exp: Remove breakpoint on "exit-line".
+ (uncaught return): Remove.
+
2009-12-23 Jan Kratochvil <jan.kratochvil@redhat.com>
Phil Muldoon <pmuldoon@redhat.com>
--- src/gdb/testsuite/gdb.cp/expand-sals.cc 2009/05/11 15:05:56 1.1
+++ src/gdb/testsuite/gdb.cp/expand-sals.cc 2009/12/24 21:57:06 1.2
@@ -49,5 +49,5 @@
A a;
B b;
- return 0; /* exit-line */
+ return 0;
}
--- src/gdb/testsuite/gdb.cp/expand-sals.exp 2009/05/11 15:05:56 1.1
+++ src/gdb/testsuite/gdb.cp/expand-sals.exp 2009/12/24 21:57:06 1.2
@@ -23,8 +23,6 @@
return -1
}
-gdb_breakpoint [gdb_get_line_number "exit-line"]
-
gdb_breakpoint [gdb_get_line_number "func-line"]
gdb_continue_to_breakpoint "func" ".*func-line.*"
@@ -52,7 +50,3 @@
"bt from A"
gdb_continue_to_breakpoint "next caller func" ".*func-line.*"
-
-# Verify GDB really could not catch any other breakpoint location.
-
-gdb_continue_to_breakpoint "uncaught return" ".*exit-line.*"
http://sourceware.org/ml/gdb-cvs/2009-11/msg00213.html
[ cut ]
--- src/gdb/testsuite/gdb.base/condbreak.exp 2009/01/03 05:58:03 1.13
+++ src/gdb/testsuite/gdb.base/condbreak.exp 2009/11/25 20:43:29 1.14
@@ -207,10 +207,10 @@
setup_xfail hppa2.0w-*-* 11512CLLbs
send_gdb "continue\n"
gdb_expect {
- -re "Continuing\\..*Breakpoint \[0-9\]+, marker2 \\(a=43\\) at .*$srcfile1:($bp_location8|$bp_location9).*($bp_location8|$bp_location9)\[\t \]+.*" {
+ -re "Continuing\\..*Breakpoint \[0-9\]+, marker2 \\(a=43\\) at .*$srcfile1:($bp_location8|$bp_location9).*($bp_location8|$bp_location9)\[\t \]+.*$gdb_prompt $" {
pass "run until breakpoint at marker2"
}
- -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker2 \\(a=43\\) at .*$srcfile1:($bp_location8|$bp_location9).*($bp_location8|$bp_location9)\[\t \]+.*" {
+ -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker2 \\(a=43\\) at .*$srcfile1:($bp_location8|$bp_location9).*($bp_location8|$bp_location9)\[\t \]+.*$gdb_prompt $" {
xfail "run until breakpoint at marker2"
}
-re "$gdb_prompt $" {
Fix for gfortran-4.1:
-PASS: gdb.mi/mi-var-child-f.exp: mi runto MAIN__
+FAIL: gdb.mi/mi-var-child-f.exp: mi runto MAIN__ (unknown output after running)
RFC: Move language-changed message to verbose
http://sourceware.org/ml/gdb-patches/2009-11/msg00031.html
http://sourceware.org/ml/gdb-cvs/2009-11/msg00034.html
### src/gdb/ChangeLog 2009/11/05 19:53:03 1.11030
### src/gdb/ChangeLog 2009/11/05 20:43:52 1.11031
## -1,3 +1,8 @@
+2009-11-05 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * top.c (execute_command): Select a frame before checking the current
+ language. Only output a message if verbose.
+
2009-11-05 Tom Tromey <tromey@redhat.com>
* symtab.h (SYMBOL_SET_LINKAGE_NAME): Update comment.
--- src/gdb/top.c 2009/10/19 09:51:42 1.172
+++ src/gdb/top.c 2009/11/05 20:43:52 1.173
@@ -457,10 +457,13 @@
}
- /* Tell the user if the language has changed (except first time). */
+ /* Tell the user if the language has changed (except first time).
+ First make sure that a new frame has been selected, in case this
+ command or the hooks changed the program state. */
+ deprecated_safe_get_selected_frame ();
if (current_language != expected_language)
{
- if (language_mode == language_mode_auto)
+ if (language_mode == language_mode_auto && info_verbose)
{
language_info (1); /* Print what changed. */
}
https://bugzilla.redhat.com/show_bug.cgi?id=578136
https://bugzilla.redhat.com/show_bug.cgi?id=593926
http://sourceware.org/ml/gdb-patches/2010-04/msg00820.html
http://sourceware.org/ml/gdb-cvs/2010-04/msg00240.html
### src/gdb/ChangeLog 2010/04/23 18:09:16 1.11678
### src/gdb/ChangeLog 2010/04/23 21:44:19 1.11679
## -1,3 +1,14 @@
+2010-04-23 Daniel Jacobowitz <dan@codesourcery.com>
+ Paul Pluzhnikov <ppluzhnikov@google.com>
+ Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Fix deadlock on looped list of loaded shared objects.
+ * solib-svr4.c (LM_PREV): New function.
+ (IGNORE_FIRST_LINK_MAP_ENTRY): Use it.
+ (svr4_current_sos): Check for correct l_prev. New variables prev_lm
+ and next_lm. Clear prev_lm for solib_svr4_r_ldsomap.
+ * config/djgpp/fnchange.lst: Add translation for solib-corrupted.exp.
+
2010-04-23 Doug Evans <dje@google.com>
* configure.ac (CONFIG_SRCS): Add py-auto-load.o even if not using
--- src/gdb/solib-svr4.c 2010/03/11 22:07:02 1.130
+++ src/gdb/solib-svr4.c 2010/04/23 21:44:19 1.131
@@ -272,6 +272,16 @@
}
static CORE_ADDR
+LM_PREV (struct so_list *so)
+{
+ struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
+ struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
+
+ return extract_typed_address (so->lm_info->lm + lmo->l_prev_offset,
+ ptr_type);
+}
+
+static CORE_ADDR
LM_NAME (struct so_list *so)
{
struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
@@ -284,16 +294,12 @@
static int
IGNORE_FIRST_LINK_MAP_ENTRY (struct so_list *so)
{
- struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
- struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
-
/* Assume that everything is a library if the dynamic loader was loaded
late by a static executable. */
if (exec_bfd && bfd_get_section_by_name (exec_bfd, ".dynamic") == NULL)
return 0;
- return extract_typed_address (so->lm_info->lm + lmo->l_prev_offset,
- ptr_type) == 0;
+ return LM_PREV (so) == 0;
}
/* Per-inferior SVR4 specific data. */
@@ -1101,7 +1107,7 @@
static struct so_list *
svr4_current_sos (void)
{
- CORE_ADDR lm;
+ CORE_ADDR lm, prev_lm;
struct so_list *head = 0;
struct so_list **link_ptr = &head;
CORE_ADDR ldsomap = 0;
@@ -1120,6 +1126,7 @@
/* Walk the inferior's link map list, and build our list of
`struct so_list' nodes. */
+ prev_lm = 0;
lm = solib_svr4_r_map (info);
while (lm)
@@ -1127,6 +1134,7 @@
struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
struct so_list *new = XZALLOC (struct so_list);
struct cleanup *old_chain = make_cleanup (xfree, new);
+ CORE_ADDR next_lm;
new->lm_info = xmalloc (sizeof (struct lm_info));
make_cleanup (xfree, new->lm_info);
@@ -1138,14 +1146,21 @@
read_memory (lm, new->lm_info->lm, lmo->link_map_size);
- lm = LM_NEXT (new);
+ next_lm = LM_NEXT (new);
+
+ if (LM_PREV (new) != prev_lm)
+ {
+ warning (_("Corrupted shared library list"));
+ free_so (new);
+ next_lm = 0;
+ }
/* For SVR4 versions, the first entry in the link map is for the
inferior executable, so we must ignore it. For some versions of
SVR4, it has no name. For others (Solaris 2.3 for example), it
does have a name, so we can no longer use a missing name to
decide when to ignore it. */
- if (IGNORE_FIRST_LINK_MAP_ENTRY (new) && ldsomap == 0)
+ else if (IGNORE_FIRST_LINK_MAP_ENTRY (new) && ldsomap == 0)
{
info->main_lm_addr = new->lm_info->lm_addr;
free_so (new);
@@ -1182,12 +1197,18 @@
}
}
+ prev_lm = lm;
+ lm = next_lm;
+
/* On Solaris, the dynamic linker is not in the normal list of
shared objects, so make sure we pick it up too. Having
symbol information for the dynamic linker is quite crucial
for skipping dynamic linker resolver code. */
if (lm == 0 && ldsomap == 0)
- lm = ldsomap = solib_svr4_r_ldsomap (info);
+ {
+ lm = ldsomap = solib_svr4_r_ldsomap (info);
+ prev_lm = 0;
+ }
discard_cleanups (old_chain);
}
--- src/gdb/config/djgpp/fnchange.lst 2010/04/09 15:15:05 1.112
+++ src/gdb/config/djgpp/fnchange.lst 2010/04/23 21:44:19 1.113
@@ -397,6 +397,7 @@
@V@/gdb/testsuite/gdb.base/siginfo-obj.c @V@/gdb/testsuite/gdb.base/si-obj.c
@V@/gdb/testsuite/gdb.base/siginfo-addr.exp @V@/gdb/testsuite/gdb.base/si-addr.exp
@V@/gdb/testsuite/gdb.base/siginfo-obj.exp @V@/gdb/testsuite/gdb.base/si-obj.exp
+@V@/gdb/testsuite/gdb.base/solib-corrupted.exp @V@/gdb/testsuite/gdb.base/so-crptd.exp
@V@/gdb/testsuite/gdb.base/solib-disc.c @V@/gdb/testsuite/gdb.base/so-disc.c
@V@/gdb/testsuite/gdb.base/solib-display-lib.c @V@/gdb/testsuite/gdb.base/so-displib.c
@V@/gdb/testsuite/gdb.base/solib-display-main.c @V@/gdb/testsuite/gdb.base/so-dispmain.c
### src/gdb/testsuite/ChangeLog 2010/04/23 18:03:31 1.2252
### src/gdb/testsuite/ChangeLog 2010/04/23 21:44:20 1.2253
## -1,3 +1,8 @@
+2010-04-23 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Fix deadlock on looped list of loaded shared objects.
+ * gdb.base/solib-corrupted.exp: New.
+
2010-04-23 Doug Evans <dje@google.com>
* gdb.python/py-section-script.c: New file.
--- src/gdb/testsuite/gdb.base/solib-corrupted.exp
+++ src/gdb/testsuite/gdb.base/solib-corrupted.exp 2010-05-24 18:00:52.057995000 +0000
@@ -0,0 +1,46 @@
+# Copyright 2010 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/>.
+
+set testfile "solib-corrupted"
+set srcfile start.c
+
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } {
+ untested ${testfile}.exp
+ return -1
+}
+
+if ![runto_main] {
+ fail "Can't run to main"
+ return
+}
+
+gdb_test "info sharedlibrary" "" "normal list"
+
+# GDB checks there for matching L_PREV.
+set test "make solibs looping"
+gdb_test_multiple "p/x _r_debug->r_map->l_next = _r_debug->r_map" $test {
+ -re "(No symbol \"_r_debug\" in current context\\.|Attempt to extract a component of a value that is not a structure pointer\\.)\r\n$gdb_prompt $" {
+ # glibc debug info is not available and it is too difficult to find and
+ # parse it from this testcase without the gdb supporting functions.
+ verbose -log "no _r_debug symbol has been found"
+ xfail $test
+ untested ${testfile}.exp
+ return
+ }
+ -re " = 0x\[0-9a-f\]+\r\n$gdb_prompt $" {
+ pass $test
+ }
+}
+gdb_test "info sharedlibrary" "warning: Corrupted shared library list\r\n.*" "corrupted list"
FYI: fix java-related crash
http://sourceware.org/ml/gdb-patches/2010-02/msg00445.html
http://sourceware.org/ml/gdb-cvs/2010-02/msg00142.html
[ Backported. ]
### src/gdb/ChangeLog 2010/02/17 20:54:52 1.11374
### src/gdb/ChangeLog 2010/02/17 22:25:04 1.11375
## -1,3 +1,7 @@
+2010-02-17 Tom Tromey <tromey@redhat.com>
+
+ * objfiles.c (gdb_bfd_ref): Handle abfd==NULL.
+
2010-02-17 Jan Kratochvil <jan.kratochvil@redhat.com>
* symfile.c (build_section_addr_info_from_objfile): Include sections
--- src/gdb/objfiles.c 2010/02/09 10:59:50 1.110
+++ src/gdb/objfiles.c 2010/02/17 22:25:05 1.111
@@ -1504,7 +1504,12 @@
struct bfd *
gdb_bfd_ref (struct bfd *abfd)
{
- int *p_refcount = bfd_usrdata (abfd);
+ int *p_refcount;
+
+ if (abfd == NULL)
+ return NULL;
+
+ p_refcount = bfd_usrdata (abfd);
if (p_refcount != NULL)
{
### src/gdb/testsuite/ChangeLog 2010/02/17 22:09:05 1.2143
### src/gdb/testsuite/ChangeLog 2010/02/17 22:25:05 1.2144
## -1,3 +1,8 @@
+2010-02-17 Tom Tromey <tromey@redhat.com>
+
+ * gdb.java/jprint.java (jprint.props): New field.
+ * gdb.java/jprint.exp (set_lang_java): Add regression test.
+
2010-02-17 Pedro Alves <pedro@codesourcery.com>
* gdb.base/charset.exp: Don't assume new `regsub' syntax
--- src/gdb/testsuite/gdb.java/jprint.exp 2010/01/01 07:32:03 1.10
+++ src/gdb/testsuite/gdb.java/jprint.exp 2010/02/17 22:25:05 1.11
@@ -84,4 +84,7 @@
gdb_test "call x.dothat(55)" "new value is 58\r\n.*= 62.*" "virtual fn call"
gdb_test "p x.addprint(1,2,3)" "sum is 6\r\n.*" "inherited static call"
gdb_test "call x.addk(44)" "adding k gives 121\r\n.*= 121.*" "inherited virtual fn call"
+
+ # Regression test for a crasher.
+ gdb_test "print *jprint.props" " = .*" "print a java.util.Properties"
}
--- gdb-7.0.1/gdb/testsuite/gdb.java/jprint.java.orig 2007-05-14 18:44:27.000000000 +0200
+++ gdb-7.0.1/gdb/testsuite/gdb.java/jprint.java 2010-06-02 12:41:07.000000000 +0200
@@ -1,6 +1,6 @@
// jprint.java test program.
//
-// Copyright 2004
+// Copyright 2004, 2010
// Free Software Foundation, Inc.
//
// Written by Jeff Johnston <jjohnstn@redhat.com>
@@ -23,6 +23,8 @@
// Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
+import java.util.Properties;
+
class jvclass {
public static int k;
static {
@@ -41,6 +43,8 @@ class jvclass {
}
public class jprint extends jvclass {
+ public static Properties props = new Properties ();
+
public int dothat (int x) {
int y = x + 3;
System.out.println ("new value is " + y);
https://bugzilla.redhat.com/show_bug.cgi?id=610986
http://sourceware.org/ml/gdb-cvs/2010-08/msg00112.html
### src/gdb/ChangeLog 2010/08/18 22:57:45 1.12097
### src/gdb/ChangeLog 2010/08/19 07:34:26 1.12098
## -1,3 +1,9 @@
+2010-08-19 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * varobj.c (varobj_create): Replace variable old_fi with old_id,
+ initialize it by null_frame_id, wrap its usage by get_frame_id,
+ frame_id_p and frame_find_by_id.
+
2010-08-18 Tom Tromey <tromey@redhat.com>
PR python/11900:
--- src/gdb/varobj.c 2010/08/06 14:17:56 1.159
+++ src/gdb/varobj.c 2010/08/19 07:34:27 1.160
@@ -524,7 +524,7 @@ varobj_create (char *objname,
{
struct varobj *var;
struct frame_info *fi;
- struct frame_info *old_fi = NULL;
+ struct frame_id old_id = null_frame_id;
struct block *block;
struct cleanup *old_chain;
@@ -611,7 +611,7 @@
var->root->frame = get_frame_id (fi);
var->root->thread_id = pid_to_thread_id (inferior_ptid);
- old_fi = get_selected_frame (NULL);
+ old_id = get_frame_id (get_selected_frame (NULL));
select_frame (fi);
}
@@ -639,8 +639,8 @@
var->root->rootvar = var;
/* Reset the selected frame */
- if (old_fi != NULL)
- select_frame (old_fi);
+ if (frame_id_p (old_id))
+ select_frame (frame_find_by_id (old_id));
}
/* If the variable object name is null, that means this

32
gdb-archer-ada.patch Normal file
View File

@ -0,0 +1,32 @@
From: Keith Seitz <keiths@redhat.com>
Message-ID: <4B7F207A.7020102@redhat.com>
--- gdb-7.0.1-orig/gdb/dwarf2read.c 2010-02-20 01:06:44.000000000 +0100
+++ gdb-7.0.1/gdb/dwarf2read.c 2010-02-20 01:08:28.000000000 +0100
@@ -7362,6 +7362,10 @@ read_partial_die (struct partial_die_inf
break;
}
break;
+ case DW_AT_MIPS_linkage_name:
+ if (cu->language == language_ada)
+ part_die->name = DW_STRING (&attr);
+ break;
case DW_AT_comp_dir:
if (part_die->dirname == NULL)
part_die->dirname = DW_STRING (&attr);
@@ -9924,9 +9928,13 @@ dwarf2_canonicalize_name (char *name, st
static char *
dwarf2_name (struct die_info *die, struct dwarf2_cu *cu)
{
- struct attribute *attr;
+ struct attribute *attr = NULL;
+
+ if (cu->language == language_ada)
+ attr = dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu);
- attr = dwarf2_attr (die, DW_AT_name, cu);
+ if (!attr)
+ attr = dwarf2_attr (die, DW_AT_name, cu);
if (!attr || !DW_STRING (attr))
return NULL;

View File

@ -0,0 +1,639 @@
Remove some files accidentally created (and not used) by gdb-archer.patch.
diff -up -ruNp gdb-7.0.1-orig/gdb/config/i386/nm-i386.h gdb-7.0.1/gdb/config/i386/nm-i386.h
--- gdb-7.0.1-orig/gdb/config/i386/nm-i386.h 2010-02-09 11:22:39.000000000 +0100
+++ gdb-7.0.1/gdb/config/i386/nm-i386.h 1970-01-01 01:00:00.000000000 +0100
@@ -1,125 +0,0 @@
-/* Native macro definitions for GDB on an Intel i[3456]86.
- Copyright 2001, 2004, 2007, 2008, 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/>. */
-
-#ifndef NM_I386_H
-#define NM_I386_H 1
-
-/* Hardware-assisted breakpoints and watchpoints. */
-
-/* Targets should define this to use the generic x86 watchpoint support. */
-#ifdef I386_USE_GENERIC_WATCHPOINTS
-
-/* Add watchpoint methods to the provided target_ops. Targets which call
- this should also define I386_WATCHPOINTS_IN_TARGET_VECTOR. */
-struct target_ops;
-void i386_use_watchpoints (struct target_ops *);
-
-/* Clear the reference counts and forget everything we knew about DRi. */
-extern void i386_cleanup_dregs (void);
-
-/* Insert a watchpoint to watch a memory region which starts at
- address ADDR and whose length is LEN bytes. Watch memory accesses
- of the type TYPE. Return 0 on success, -1 on failure. */
-extern int i386_insert_watchpoint (CORE_ADDR addr, int len, int type);
-
-/* Remove a watchpoint that watched the memory region which starts at
- address ADDR, whose length is LEN bytes, and for accesses of the
- type TYPE. Return 0 on success, -1 on failure. */
-extern int i386_remove_watchpoint (CORE_ADDR addr, int len, int type);
-
-/* Return non-zero if we can watch a memory region that starts at
- address ADDR and whose length is LEN bytes. */
-extern int i386_region_ok_for_watchpoint (CORE_ADDR addr, int len);
-
-/* Return non-zero if the inferior has some break/watchpoint that
- triggered. */
-extern int i386_stopped_by_hwbp (void);
-
-/* If the inferior has some break/watchpoint that triggered, set
- the address associated with that break/watchpoint and return
- true. Otherwise, return false. */
-extern int i386_stopped_data_address (struct target_ops *, CORE_ADDR *);
-
-/* Insert a hardware-assisted breakpoint at BP_TGT->placed_address.
- Return 0 on success, EBUSY on failure. */
-struct bp_target_info;
-extern int i386_insert_hw_breakpoint (struct bp_target_info *bp_tgt);
-
-/* Remove a hardware-assisted breakpoint at BP_TGT->placed_address.
- Return 0 on success, -1 on failure. */
-extern int i386_remove_hw_breakpoint (struct bp_target_info *bp_tgt);
-
-extern int i386_stopped_by_watchpoint (void);
-
-#ifndef I386_WATCHPOINTS_IN_TARGET_VECTOR
-
-/* Returns the number of hardware watchpoints of type TYPE that we can
- set. Value is positive if we can set CNT watchpoints, zero if
- setting watchpoints of type TYPE is not supported, and negative if
- CNT is more than the maximum number of watchpoints of type TYPE
- that we can support. TYPE is one of bp_hardware_watchpoint,
- bp_read_watchpoint, bp_write_watchpoint, or bp_hardware_breakpoint.
- CNT is the number of such watchpoints used so far (including this
- one). OTHERTYPE is non-zero if other types of watchpoints are
- currently enabled.
-
- We always return 1 here because we don't have enough information
- about possible overlap of addresses that they want to watch. As an
- extreme example, consider the case where all the watchpoints watch
- the same address and the same region length: then we can handle a
- virtually unlimited number of watchpoints, due to debug register
- sharing implemented via reference counts in i386-nat.c. */
-
-#define TARGET_CAN_USE_HARDWARE_WATCHPOINT(type, cnt, ot) 1
-
-/* Returns non-zero if we can use hardware watchpoints to watch a
- region whose address is ADDR and whose length is LEN. */
-
-#define TARGET_REGION_OK_FOR_HW_WATCHPOINT(addr, len) \
- i386_region_ok_for_watchpoint (addr, len)
-
-/* After a watchpoint trap, the PC points to the instruction after the
- one that caused the trap. Therefore we don't need to step over it.
- But we do need to reset the status register to avoid another trap. */
-
-#define HAVE_CONTINUABLE_WATCHPOINT 1
-
-#define STOPPED_BY_WATCHPOINT(W) (i386_stopped_by_watchpoint () != 0)
-
-#define target_stopped_data_address(target, x) \
- i386_stopped_data_address(target, x)
-
-/* Use these macros for watchpoint insertion/removal. */
-
-#define target_insert_watchpoint(addr, len, type) \
- i386_insert_watchpoint (addr, len, type)
-
-#define target_remove_watchpoint(addr, len, type) \
- i386_remove_watchpoint (addr, len, type)
-
-#define target_insert_hw_breakpoint(bp_tgt) \
- i386_insert_hw_breakpoint (bp_tgt)
-
-#define target_remove_hw_breakpoint(bp_tgt) \
- i386_remove_hw_breakpoint (bp_tgt)
-
-#endif /* I386_WATCHPOINTS_IN_TARGET_VECTOR */
-
-#endif /* I386_USE_GENERIC_WATCHPOINTS */
-
-#endif /* NM_I386_H */
diff -up -ruNp gdb-7.0.1-orig/gdb/config/i386/nm-linux64.h gdb-7.0.1/gdb/config/i386/nm-linux64.h
--- gdb-7.0.1-orig/gdb/config/i386/nm-linux64.h 2010-02-09 11:22:39.000000000 +0100
+++ gdb-7.0.1/gdb/config/i386/nm-linux64.h 1970-01-01 01:00:00.000000000 +0100
@@ -1,54 +0,0 @@
-/* Native support for GNU/Linux x86-64.
-
- Copyright 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009
- Free Software Foundation, Inc.
-
- Contributed by Jiri Smid, SuSE Labs.
-
- 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/>. */
-
-#ifndef NM_LINUX64_H
-#define NM_LINUX64_H
-
-/* GNU/Linux supports the i386 hardware debugging registers. */
-#define I386_USE_GENERIC_WATCHPOINTS
-#define I386_WATCHPOINTS_IN_TARGET_VECTOR
-
-#include "i386/nm-i386.h"
-#include "config/nm-linux.h"
-
-/* Support for 8-byte wide hardware watchpoints. */
-#define TARGET_HAS_DR_LEN_8 1
-
-/* Provide access to the i386 hardware debugging registers. */
-
-extern void amd64_linux_dr_set_control (unsigned long control);
-#define I386_DR_LOW_SET_CONTROL(control) \
- amd64_linux_dr_set_control (control)
-
-extern void amd64_linux_dr_set_addr (int regnum, CORE_ADDR addr);
-#define I386_DR_LOW_SET_ADDR(regnum, addr) \
- amd64_linux_dr_set_addr (regnum, addr)
-
-extern void amd64_linux_dr_reset_addr (int regnum);
-#define I386_DR_LOW_RESET_ADDR(regnum) \
- amd64_linux_dr_reset_addr (regnum)
-
-extern unsigned long amd64_linux_dr_get_status (void);
-#define I386_DR_LOW_GET_STATUS() \
- amd64_linux_dr_get_status ()
-
-#endif /* nm-linux64.h */
diff -up -ruNp gdb-7.0.1-orig/gdb/config/mips/nm-irix5.h gdb-7.0.1/gdb/config/mips/nm-irix5.h
--- gdb-7.0.1-orig/gdb/config/mips/nm-irix5.h 2010-02-09 11:22:39.000000000 +0100
+++ gdb-7.0.1/gdb/config/mips/nm-irix5.h 1970-01-01 01:00:00.000000000 +0100
@@ -1,44 +0,0 @@
-/* Definitions for native support of irix5.
-
- Copyright 1993, 1996, 1998, 1999, 2000, 2007, 2008, 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/>. */
-
-#define TARGET_HAS_HARDWARE_WATCHPOINTS
-
-/* TARGET_CAN_USE_HARDWARE_WATCHPOINT is now defined to go through
- the target vector. For Irix5, procfs_can_use_hw_watchpoint()
- should be invoked. */
-
-/* When a hardware watchpoint fires off the PC will be left at the
- instruction which caused the watchpoint. It will be necessary for
- GDB to step over the watchpoint. */
-
-#define STOPPED_BY_WATCHPOINT(W) \
- procfs_stopped_by_watchpoint(inferior_ptid)
-extern int procfs_stopped_by_watchpoint (ptid_t);
-
-/* Use these macros for watchpoint insertion/deletion. */
-/* type can be 0: write watch, 1: read watch, 2: access watch (read/write) */
-#define target_insert_watchpoint(ADDR, LEN, TYPE) \
- procfs_set_watchpoint (inferior_ptid, ADDR, LEN, TYPE, 0)
-#define target_remove_watchpoint(ADDR, LEN, TYPE) \
- procfs_set_watchpoint (inferior_ptid, ADDR, 0, 0, 0)
-extern int procfs_set_watchpoint (ptid_t, CORE_ADDR, int, int, int);
-
-#define TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT(SIZE) 1
-
diff -up -ruNp gdb-7.0.1-orig/gdb/gdbserver/linux-i386-low.c gdb-7.0.1/gdb/gdbserver/linux-i386-low.c
--- gdb-7.0.1-orig/gdb/gdbserver/linux-i386-low.c 2010-02-09 11:22:39.000000000 +0100
+++ gdb-7.0.1/gdb/gdbserver/linux-i386-low.c 1970-01-01 01:00:00.000000000 +0100
@@ -1,210 +0,0 @@
-/* GNU/Linux/i386 specific low level interface, for the remote server for GDB.
- Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006,
- 2007, 2008, 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 "server.h"
-#include "linux-low.h"
-#include "i387-fp.h"
-
-#include "gdb_proc_service.h"
-
-#include <sys/ptrace.h>
-
-#ifdef HAVE_SYS_REG_H
-#include <sys/reg.h>
-#endif
-
-#ifndef PTRACE_GET_THREAD_AREA
-#define PTRACE_GET_THREAD_AREA 25
-#endif
-
-/* Defined in auto-generated file reg-i386-linux.c. */
-void init_registers_i386_linux (void);
-
-
-/* This module only supports access to the general purpose registers. */
-
-#define i386_num_regs 16
-
-/* This stuff comes from i386-linux-nat.c. */
-
-/* Mapping between the general-purpose registers in `struct user'
- format and GDB's register array layout. */
-static int i386_regmap[] =
-{
- EAX * 4, ECX * 4, EDX * 4, EBX * 4,
- UESP * 4, EBP * 4, ESI * 4, EDI * 4,
- EIP * 4, EFL * 4, CS * 4, SS * 4,
- DS * 4, ES * 4, FS * 4, GS * 4
-};
-
-/* Called by libthread_db. */
-
-ps_err_e
-ps_get_thread_area (const struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
-{
- unsigned int desc[4];
-
- if (ptrace (PTRACE_GET_THREAD_AREA, lwpid,
- (void *) idx, (unsigned long) &desc) < 0)
- return PS_ERR;
-
- *(int *)base = desc[1];
- return PS_OK;
-}
-
-static int
-i386_cannot_store_register (int regno)
-{
- return (regno >= i386_num_regs);
-}
-
-static int
-i386_cannot_fetch_register (int regno)
-{
- return (regno >= i386_num_regs);
-}
-
-
-#ifdef HAVE_PTRACE_GETREGS
-#include <sys/procfs.h>
-#include <sys/ptrace.h>
-
-static void
-i386_fill_gregset (void *buf)
-{
- int i;
-
- for (i = 0; i < i386_num_regs; i++)
- collect_register (i, ((char *) buf) + i386_regmap[i]);
-
- collect_register_by_name ("orig_eax", ((char *) buf) + ORIG_EAX * 4);
-}
-
-static void
-i386_store_gregset (const void *buf)
-{
- int i;
-
- for (i = 0; i < i386_num_regs; i++)
- supply_register (i, ((char *) buf) + i386_regmap[i]);
-
- supply_register_by_name ("orig_eax", ((char *) buf) + ORIG_EAX * 4);
-}
-
-static void
-i386_fill_fpregset (void *buf)
-{
- i387_cache_to_fsave (buf);
-}
-
-static void
-i386_store_fpregset (const void *buf)
-{
- i387_fsave_to_cache (buf);
-}
-
-static void
-i386_fill_fpxregset (void *buf)
-{
- i387_cache_to_fxsave (buf);
-}
-
-static void
-i386_store_fpxregset (const void *buf)
-{
- i387_fxsave_to_cache (buf);
-}
-
-#endif /* HAVE_PTRACE_GETREGS */
-
-struct regset_info target_regsets[] = {
-#ifdef HAVE_PTRACE_GETREGS
- { PTRACE_GETREGS, PTRACE_SETREGS, sizeof (elf_gregset_t),
- GENERAL_REGS,
- i386_fill_gregset, i386_store_gregset },
-# ifdef HAVE_PTRACE_GETFPXREGS
- { PTRACE_GETFPXREGS, PTRACE_SETFPXREGS, sizeof (elf_fpxregset_t),
- EXTENDED_REGS,
- i386_fill_fpxregset, i386_store_fpxregset },
-# endif
- { PTRACE_GETFPREGS, PTRACE_SETFPREGS, sizeof (elf_fpregset_t),
- FP_REGS,
- i386_fill_fpregset, i386_store_fpregset },
-#endif /* HAVE_PTRACE_GETREGS */
- { 0, 0, -1, -1, NULL, NULL }
-};
-
-static const unsigned char i386_breakpoint[] = { 0xCC };
-#define i386_breakpoint_len 1
-
-extern int debug_threads;
-
-static CORE_ADDR
-i386_get_pc ()
-{
- unsigned long pc;
-
- collect_register_by_name ("eip", &pc);
-
- if (debug_threads)
- fprintf (stderr, "stop pc (before any decrement) is %08lx\n", pc);
- return pc;
-}
-
-static void
-i386_set_pc (CORE_ADDR newpc)
-{
- if (debug_threads)
- fprintf (stderr, "set pc to %08lx\n", (long) newpc);
- supply_register_by_name ("eip", &newpc);
-}
-
-static int
-i386_breakpoint_at (CORE_ADDR pc)
-{
- unsigned char c;
-
- read_inferior_memory (pc, &c, 1);
- if (c == 0xCC)
- return 1;
-
- return 0;
-}
-
-struct linux_target_ops the_low_target = {
- init_registers_i386_linux,
- i386_num_regs,
- i386_regmap,
- i386_cannot_fetch_register,
- i386_cannot_store_register,
- i386_get_pc,
- i386_set_pc,
- i386_breakpoint,
- i386_breakpoint_len,
- NULL,
- 1,
- i386_breakpoint_at,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
-};
diff -up -ruNp gdb-7.0.1-orig/gdb/gdbserver/linux-x86-64-low.c gdb-7.0.1/gdb/gdbserver/linux-x86-64-low.c
--- gdb-7.0.1-orig/gdb/gdbserver/linux-x86-64-low.c 2010-02-09 11:22:39.000000000 +0100
+++ gdb-7.0.1/gdb/gdbserver/linux-x86-64-low.c 1970-01-01 01:00:00.000000000 +0100
@@ -1,184 +0,0 @@
-/* GNU/Linux/x86-64 specific low level interface, for the remote server
- for GDB.
- Copyright (C) 2002, 2004, 2005, 2006, 2007, 2008, 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 "server.h"
-#include "linux-low.h"
-#include "i387-fp.h"
-
-#include "gdb_proc_service.h"
-
-/* Defined in auto-generated file reg-x86-64-linux.c. */
-void init_registers_x86_64_linux (void);
-
-#include <sys/reg.h>
-#include <sys/procfs.h>
-#include <sys/ptrace.h>
-
-/* This definition comes from prctl.h, but some kernels may not have it. */
-#ifndef PTRACE_ARCH_PRCTL
-#define PTRACE_ARCH_PRCTL 30
-#endif
-
-/* The following definitions come from prctl.h, but may be absent
- for certain configurations. */
-#ifndef ARCH_GET_FS
-#define ARCH_SET_GS 0x1001
-#define ARCH_SET_FS 0x1002
-#define ARCH_GET_FS 0x1003
-#define ARCH_GET_GS 0x1004
-#endif
-
-static int x86_64_regmap[] = {
- RAX * 8, RBX * 8, RCX * 8, RDX * 8,
- RSI * 8, RDI * 8, RBP * 8, RSP * 8,
- R8 * 8, R9 * 8, R10 * 8, R11 * 8,
- R12 * 8, R13 * 8, R14 * 8, R15 * 8,
- RIP * 8, EFLAGS * 8, CS * 8, SS * 8,
- DS * 8, ES * 8, FS * 8, GS * 8,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1,
- ORIG_RAX * 8
-};
-
-#define X86_64_NUM_GREGS (sizeof(x86_64_regmap)/sizeof(int))
-
-/* Called by libthread_db. */
-
-ps_err_e
-ps_get_thread_area (const struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
-{
- switch (idx)
- {
- case FS:
- if (ptrace (PTRACE_ARCH_PRCTL, lwpid, base, ARCH_GET_FS) == 0)
- return PS_OK;
- break;
- case GS:
- if (ptrace (PTRACE_ARCH_PRCTL, lwpid, base, ARCH_GET_GS) == 0)
- return PS_OK;
- break;
- default:
- return PS_BADADDR;
- }
- return PS_ERR;
-}
-
-static void
-x86_64_fill_gregset (void *buf)
-{
- int i;
-
- for (i = 0; i < X86_64_NUM_GREGS; i++)
- if (x86_64_regmap[i] != -1)
- collect_register (i, ((char *) buf) + x86_64_regmap[i]);
-}
-
-static void
-x86_64_store_gregset (const void *buf)
-{
- int i;
-
- for (i = 0; i < X86_64_NUM_GREGS; i++)
- if (x86_64_regmap[i] != -1)
- supply_register (i, ((char *) buf) + x86_64_regmap[i]);
-}
-
-static void
-x86_64_fill_fpregset (void *buf)
-{
- i387_cache_to_fxsave (buf);
-}
-
-static void
-x86_64_store_fpregset (const void *buf)
-{
- i387_fxsave_to_cache (buf);
-}
-
-struct regset_info target_regsets[] = {
- { PTRACE_GETREGS, PTRACE_SETREGS, sizeof (elf_gregset_t),
- GENERAL_REGS,
- x86_64_fill_gregset, x86_64_store_gregset },
- { PTRACE_GETFPREGS, PTRACE_SETFPREGS, sizeof (elf_fpregset_t),
- FP_REGS,
- x86_64_fill_fpregset, x86_64_store_fpregset },
- { 0, 0, -1, -1, NULL, NULL }
-};
-
-static const unsigned char x86_64_breakpoint[] = { 0xCC };
-#define x86_64_breakpoint_len 1
-
-extern int debug_threads;
-
-static CORE_ADDR
-x86_64_get_pc ()
-{
- unsigned long pc;
-
- collect_register_by_name ("rip", &pc);
-
- if (debug_threads)
- fprintf (stderr, "stop pc (before any decrement) is %08lx\n", pc);
- return pc;
-}
-
-static void
-x86_64_set_pc (CORE_ADDR newpc)
-{
- if (debug_threads)
- fprintf (stderr, "set pc to %08lx\n", (long) newpc);
- supply_register_by_name ("rip", &newpc);
-}
-
-static int
-x86_64_breakpoint_at (CORE_ADDR pc)
-{
- unsigned char c;
-
- read_inferior_memory (pc, &c, 1);
- if (c == 0xCC)
- return 1;
-
- return 0;
-}
-
-struct linux_target_ops the_low_target = {
- init_registers_x86_64_linux,
- -1,
- NULL,
- NULL,
- NULL,
- x86_64_get_pc,
- x86_64_set_pc,
- x86_64_breakpoint,
- x86_64_breakpoint_len,
- NULL,
- 1,
- x86_64_breakpoint_at,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
-};

View File

@ -0,0 +1,100 @@
Archer-upstreamed:
http://sourceware.org/ml/archer/2010-q2/msg00031.html
--- ./gdb/breakpoint.c 2010-05-29 01:12:32.000000000 +0200
+++ ./gdb/breakpoint.c 2010-05-29 01:22:21.000000000 +0200
@@ -1679,14 +1679,11 @@ create_exception_master_breakpoint (void
debug_hook = lookup_minimal_symbol_text ("_Unwind_DebugHook", objfile);
if (debug_hook != NULL)
{
- CORE_ADDR pc;
struct breakpoint *b;
- pc = find_function_start_pc (get_objfile_arch (objfile),
- SYMBOL_VALUE_ADDRESS (debug_hook),
- SYMBOL_OBJ_SECTION (debug_hook));
b = create_internal_breakpoint (get_objfile_arch (objfile),
- pc, bp_exception_master);
+ SYMBOL_VALUE_ADDRESS (debug_hook),
+ bp_exception_master);
b->addr_string = xstrdup ("_Unwind_DebugHook");
b->enable_state = bp_disabled;
}
--- ./gdb/testsuite/gdb.cp/cxxexec.cc 1970-01-01 01:00:00.000000000 +0100
+++ ./gdb/testsuite/gdb.cp/cxxexec.cc 2010-05-29 01:18:56.000000000 +0200
@@ -0,0 +1,25 @@
+/* This test script is part of GDB, the GNU debugger.
+
+ Copyright 2010 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 <unistd.h>
+
+int
+main()
+{
+ execlp ("true", "true", NULL);
+ return 1;
+}
--- ./gdb/testsuite/gdb.cp/cxxexec.exp 1970-01-01 01:00:00.000000000 +0100
+++ ./gdb/testsuite/gdb.cp/cxxexec.exp 2010-05-29 01:29:25.000000000 +0200
@@ -0,0 +1,47 @@
+# Copyright 2010 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/>.
+
+if { [skip_cplus_tests] } { continue }
+
+set testfile cxxexec
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${testfile}.cc {c++ debug}] } {
+ return -1
+}
+
+runto_main
+
+set test "p _Unwind_DebugHook"
+gdb_test_multiple $test $test {
+ -re " = .* 0x\[0-9a-f\].*\r\n$gdb_prompt $" {
+ pass $test
+ }
+ -re "\r\nNo symbol .*\r\n$gdb_prompt $" {
+ xfail $test
+ untested ${testfile}.exp
+ return -1
+ }
+}
+
+set test continue
+gdb_test_multiple $test $test {
+ -re "Cannot access memory at address 0x\[0-9a-f\]+\r\n$gdb_prompt $" {
+ fail $test
+ }
+ -re "\r\n$gdb_prompt $" {
+ pass $test
+ }
+}
+
+gdb_test "info inferiors" "No inferiors." "program finished"

View File

@ -0,0 +1,122 @@
--- ./gdb/breakpoint.c 2009-12-18 00:13:49.000000000 +0100
+++ ./gdb/breakpoint.c 2009-12-18 00:13:16.000000000 +0100
@@ -8563,6 +8563,49 @@ update_breakpoint_locations (struct brea
update_global_location_list (1);
}
+void
+breakpoints_relocate (struct objfile *objfile, struct section_offsets *delta)
+{
+ struct bp_location *bl, **blp_tmp;
+ int changed = 0;
+
+ gdb_assert (objfile->separate_debug_objfile_backlink == NULL);
+
+ ALL_BP_LOCATIONS (bl, blp_tmp)
+ {
+ struct obj_section *osect;
+
+ /* BL->SECTION can be correctly NULL for breakpoints with multiple
+ locations expanded through symtab. */
+
+ ALL_OBJFILE_OSECTIONS (objfile, osect)
+ {
+ CORE_ADDR relocated_address;
+ CORE_ADDR delta_offset;
+
+ delta_offset = ANOFFSET (delta, osect->the_bfd_section->index);
+ if (delta_offset == 0)
+ continue;
+ relocated_address = bl->address + delta_offset;
+
+ if (obj_section_addr (osect) <= relocated_address
+ && relocated_address < obj_section_endaddr (osect))
+ {
+ if (bl->inserted)
+ remove_breakpoint (bl, mark_uninserted);
+
+ bl->address += delta_offset;
+ bl->requested_address += delta_offset;
+
+ changed = 1;
+ }
+ }
+ }
+
+ if (changed)
+ qsort (bp_location, bp_location_count, sizeof (*bp_location),
+ bp_location_compare_for_qsort);
+}
/* Reset a breakpoint given it's struct breakpoint * BINT.
The value we return ends up being the return value from catch_errors.
--- ./gdb/breakpoint.h 2009-12-18 00:13:48.000000000 +0100
+++ ./gdb/breakpoint.h 2009-12-17 22:11:10.000000000 +0100
@@ -970,4 +970,7 @@ extern struct breakpoint *get_tracepoint
is newly allocated; the caller should free when done with it. */
extern VEC(breakpoint_p) *all_tracepoints (void);
+extern void breakpoints_relocate (struct objfile *objfile,
+ struct section_offsets *delta);
+
#endif /* !defined (BREAKPOINT_H) */
--- ./gdb/objfiles.c 2009-12-18 00:13:48.000000000 +0100
+++ ./gdb/objfiles.c 2009-12-17 23:19:22.000000000 +0100
@@ -546,7 +546,7 @@ free_all_objfiles (void)
/* Relocate OBJFILE to NEW_OFFSETS. There should be OBJFILE->NUM_SECTIONS
entries in new_offsets. SEPARATE_DEBUG_OBJFILE is not touched here. */
-static void
+static int
objfile_relocate1 (struct objfile *objfile, struct section_offsets *new_offsets)
{
struct obj_section *s;
@@ -565,7 +565,7 @@ objfile_relocate1 (struct objfile *objfi
something_changed = 1;
}
if (!something_changed)
- return;
+ return 0;
}
/* OK, get all the symtabs. */
@@ -706,6 +706,13 @@ objfile_relocate1 (struct objfile *objfi
exec_set_section_address (bfd_get_filename (objfile->obfd), idx,
obj_section_addr (s));
}
+
+ /* Final call of breakpoint_re_set can keep breakpoint locations disabled if
+ their addresses match. */
+ if (objfile->separate_debug_objfile_backlink == NULL)
+ breakpoints_relocate (objfile, delta);
+
+ return 1;
}
/* Relocate OBJFILE to NEW_OFFSETS. There should be OBJFILE->NUM_SECTIONS
@@ -720,7 +727,9 @@ objfile_relocate1 (struct objfile *objfi
void
objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets)
{
- objfile_relocate1 (objfile, new_offsets);
+ int changed = 0;
+
+ changed |= objfile_relocate1 (objfile, new_offsets);
if (objfile->separate_debug_objfile != NULL)
{
@@ -747,11 +756,12 @@ objfile_relocate (struct objfile *objfil
objfile_addrs);
do_cleanups (my_cleanups);
- objfile_relocate1 (debug_objfile, new_debug_offsets);
+ changed |= objfile_relocate1 (debug_objfile, new_debug_offsets);
}
/* Relocate breakpoints as necessary, after things are relocated. */
- breakpoint_re_set ();
+ if (changed)
+ breakpoint_re_set ();
}
/* Return non-zero if OBJFILE has partial symbols. */

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

@ -0,0 +1,312 @@
--- 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
@@ -1672,15 +1672,20 @@ static CORE_ADDR
svr4_exec_displacement (void)
{
int found;
+ /* ENTRY_POINT is a possible function descriptor - before
+ a call to gdbarch_convert_from_func_ptr_addr. */
CORE_ADDR entry_point;
if (exec_bfd == NULL)
return 0;
if (target_auxv_search (&current_target, AT_ENTRY, &entry_point) == 1)
- return entry_point - exec_entry_point (exec_bfd, &current_target);
+ return entry_point - bfd_get_start_address (exec_bfd);
- 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;
}
--- gdb-7.0/gdb/testsuite/gdb.base/valgrind-db-attach.exp-orig 2009-12-21 16:50:42.000000000 +0100
+++ gdb-7.0/gdb/testsuite/gdb.base/valgrind-db-attach.exp 2009-12-21 16:51:24.000000000 +0100
@@ -67,6 +67,8 @@ gdb_test_multiple "" $test {
}
}
+gdb_test "" "" "eat first prompt"
+
# Initialization from default_gdb_start.
gdb_test "set height 0"
gdb_test "set width 0"

2647
gdb-archer-pie.patch Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,101 @@
http://sourceware.org/ml/gdb-patches/2010-01/msg00030.html
Subject: [patch] Re: Regression: field type preservation: 7.0 -> 7.0.1+HEAD
On Friday 01 January 2010 21:45:05 Jan Kratochvil wrote:
> -PASS: gdb.mi/mi-var-child.exp: get children of struct_declarations.s2.u2.u1s1
> +FAIL: gdb.mi/mi-var-child.exp: get children of struct_declarations.s2.u2.u1s1
> -PASS: gdb.mi/mi2-var-child.exp: get children of struct_declarations.s2.u2.u1s1
> +FAIL: gdb.mi/mi2-var-child.exp: get children of struct_declarations.s2.u2.u1s1
> -PASS: gdb.python/py-mi.exp: examine container children=0, no pretty-printing
> +FAIL: gdb.python/py-mi.exp: examine container children=0, no pretty-printing
>
> due to:
> Re: RFA: unbreak typedefed bitfield
> http://sourceware.org/ml/gdb-patches/2009-12/msg00295.html
> commit fc85da4ee2a7c32afc53b1b334a4f84e2e9bd84e
> http://sourceware.org/ml/gdb-cvs/2009-12/msg00100.html
attached a fix on top of existing HEAD.
Original PR gdb/10884 was a regression 6.8 -> 7.0 due to:
RFC: Lazy bitfields
http://sourceware.org/ml/gdb-patches/2009-07/msg00437.html
http://sourceware.org/ml/gdb-cvs/2009-07/msg00143.html
07491b3409f6ace0b7a9a707775a56ce10fece1c
No regressions for HEAD on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu. Plus:
-FAIL: gdb.mi/mi-var-child.exp: get children of struct_declarations.s2.u2.u1s1
+PASS: gdb.mi/mi-var-child.exp: get children of struct_declarations.s2.u2.u1s1
-FAIL: gdb.mi/mi2-var-child.exp: get children of struct_declarations.s2.u2.u1s1
+PASS: gdb.mi/mi2-var-child.exp: get children of struct_declarations.s2.u2.u1s1
-FAIL: gdb.python/py-mi.exp: examine container children=0, no pretty-printing
+PASS: gdb.python/py-mi.exp: examine container children=0, no pretty-printing
Going to check it in also for gdb_7_0-branch after an approval.
Thanks,
Jan
gdb/
2010-01-02 Jan Kratochvil <jan.kratochvil@redhat.com>
* value.c (value_primitive_field): Remove one check_typedef call.
Move bitpos and container_bitsize initialization after
allocate_value_lazy. New comment before accessing TYPE_LENGTH.
gdb/testsuite/
2010-01-02 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.mi/var-cmd.c (do_bitfield_tests): Change "V.sharable" type to
"uint_for_mi_testing".
--- a/gdb/testsuite/gdb.mi/var-cmd.c
+++ b/gdb/testsuite/gdb.mi/var-cmd.c
@@ -494,7 +494,7 @@ void do_bitfield_tests ()
mi_create_varobj V d "create varobj for Data"
mi_list_varobj_children "V" {
{"V.alloc" "alloc" "0" "int"}
- {"V.sharable" "sharable" "0" "unsigned int"}
+ {"V.sharable" "sharable" "0" "uint_for_mi_testing"}
} "list children of Data"
mi_check_varobj_value V.sharable 3 "access bitfield"
:*/
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -1873,7 +1873,6 @@ value_primitive_field (struct value *arg1, int offset,
CHECK_TYPEDEF (arg_type);
type = TYPE_FIELD_TYPE (arg_type, fieldno);
- type = check_typedef (type);
/* Handle packed fields */
@@ -1885,10 +1884,14 @@ value_primitive_field (struct value *arg1, int offset,
Otherwise, adjust offset to the byte containing the first
bit. Assume that the address, offset, and embedded offset
are sufficiently aligned. */
- int bitpos = TYPE_FIELD_BITPOS (arg_type, fieldno);
- int container_bitsize = TYPE_LENGTH (type) * 8;
+ int bitpos, container_bitsize;
v = allocate_value_lazy (type);
+
+ /* TYPE_LENGTH of TYPE gets initialized by allocate_value_lazy. */
+ bitpos = TYPE_FIELD_BITPOS (arg_type, fieldno);
+ container_bitsize = TYPE_LENGTH (type) * 8;
+
v->bitsize = TYPE_FIELD_BITSIZE (arg_type, fieldno);
if ((bitpos % container_bitsize) + v->bitsize <= container_bitsize
&& TYPE_LENGTH (type) <= (int) sizeof (LONGEST))
@@ -1939,6 +1942,8 @@ value_primitive_field (struct value *arg1, int offset,
else
{
v = allocate_value (type);
+
+ /* TYPE_LENGTH of TYPE gets initialized by allocate_value. */
memcpy (value_contents_raw (v),
value_contents_raw (arg1) + offset,
TYPE_LENGTH (type));

View File

@ -0,0 +1,137 @@
http://sourceware.org/ml/gdb-patches/2009-10/msg00509.html
Subject: [patch 2/3] find_separate_debug_file cleanup
Hi,
current code was:
* difficult to maintain as a new variable required xfree on many places
* was causing memory corruptions due to silently misapplied 3rd party patches
as the close code fragments unfortunately match patch context
Thanks,
Jan
gdb/
2009-10-21 Jan Kratochvil <jan.kratochvil@redhat.com>
* symfile.c (find_separate_debug_file): Initialize dir, debugfile and
canon_name to NULL. Change alloca to xmalloc, newly call xfree for it.
New label cleanup_return_debugfile, jump to it from the failure paths.
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -1333,11 +1333,10 @@ static char *
find_separate_debug_file (struct objfile *objfile)
{
asection *sect;
- char *basename;
- char *dir;
- char *debugfile;
- char *name_copy;
- char *canon_name;
+ char *basename, *name_copy;
+ char *dir = NULL;
+ char *debugfile = NULL;
+ char *canon_name = NULL;
bfd_size_type debuglink_size;
unsigned long crc32;
int i;
@@ -1366,7 +1365,7 @@ find_separate_debug_file (struct objfile *objfile)
if (basename == NULL)
/* There's no separate debug info, hence there's no way we could
load it => no warning. */
- return NULL;
+ goto cleanup_return_debugfile;
dir = xstrdup (objfile->name);
@@ -1388,24 +1387,19 @@ find_separate_debug_file (struct objfile *objfile)
if (canon_name && strlen (canon_name) > i)
i = strlen (canon_name);
- debugfile = alloca (strlen (debug_file_directory) + 1
- + i
- + strlen (DEBUG_SUBDIRECTORY)
- + strlen ("/")
- + strlen (basename)
- + 1);
+ debugfile = xmalloc (strlen (debug_file_directory) + 1
+ + i
+ + strlen (DEBUG_SUBDIRECTORY)
+ + strlen ("/")
+ + strlen (basename)
+ + 1);
/* First try in the same directory as the original file. */
strcpy (debugfile, dir);
strcat (debugfile, basename);
if (separate_debug_file_exists (debugfile, crc32, objfile->name))
- {
- xfree (basename);
- xfree (dir);
- xfree (canon_name);
- return xstrdup (debugfile);
- }
+ goto cleanup_return_debugfile;
/* Then try in the subdirectory named DEBUG_SUBDIRECTORY. */
strcpy (debugfile, dir);
@@ -1414,12 +1408,7 @@ find_separate_debug_file (struct objfile *objfile)
strcat (debugfile, basename);
if (separate_debug_file_exists (debugfile, crc32, objfile->name))
- {
- xfree (basename);
- xfree (dir);
- xfree (canon_name);
- return xstrdup (debugfile);
- }
+ goto cleanup_return_debugfile;
/* Then try in the global debugfile directory. */
strcpy (debugfile, debug_file_directory);
@@ -1428,12 +1417,7 @@ find_separate_debug_file (struct objfile *objfile)
strcat (debugfile, basename);
if (separate_debug_file_exists (debugfile, crc32, objfile->name))
- {
- xfree (basename);
- xfree (dir);
- xfree (canon_name);
- return xstrdup (debugfile);
- }
+ goto cleanup_return_debugfile;
/* If the file is in the sysroot, try using its base path in the
global debugfile directory. */
@@ -1447,20 +1431,17 @@ find_separate_debug_file (struct objfile *objfile)
strcat (debugfile, basename);
if (separate_debug_file_exists (debugfile, crc32, objfile->name))
- {
- xfree (canon_name);
- xfree (basename);
- xfree (dir);
- return xstrdup (debugfile);
- }
+ goto cleanup_return_debugfile;
}
- if (canon_name)
- xfree (canon_name);
+ xfree (debugfile);
+ debugfile = NULL;
+cleanup_return_debugfile:
+ xfree (canon_name);
xfree (basename);
xfree (dir);
- return NULL;
+ return debugfile;
}

View File

@ -0,0 +1,271 @@
http://sourceware.org/ml/gdb-patches/2009-10/msg00508.html
Subject: [patch 3/3] debug-file-directory with multiple components
Hi,
for various reasons `debug-file-directory' would be sometimes useful to have
multiple components such as `solib-search-path' has.
I found it useful myself during various separate debuginfo tests/scripts.
It was requested for the ABRT bugreporting project at the preceding mail of:
https://fedorahosted.org/pipermail/crash-catcher/2009-October/000054.html
It should be a backward compatible extension as DIRNAME_SEPARATOR should never
be a valid part of a single DEBUG_FILE_DIRECTORY component.
Thanks,
Jan
gdb/doc/
2009-10-22 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.texinfo (set debug-file-directory, show debug-file-directory)
(Auto-loading): Use plural and note one can use multiple components now.
gdb/
2009-10-22 Jan Kratochvil <jan.kratochvil@redhat.com>
* symfile.c (build_id_to_debug_filename): New variable debugdir. Move
variables size, s and data into a new inner block. Change xmalloc for
alloca, use direct BUILDID->SIZE there now. Loop for the
DEBUG_FILE_DIRECTORY components.
(find_separate_debug_file): New variable debugdir and debugdir_end.
Loop for the DEBUG_FILE_DIRECTORY components.
(_initialize_symfile): For "debug-file-directory" use plural and note
one can use multiple components now.
gdb/testsuite/
2009-10-22 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/sepdebug.exp: New test_different_dir call for multiple-dirs.
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -14066,13 +14066,14 @@ name @value{GDBN} is currently using.
@table @code
@kindex set debug-file-directory
-@item set debug-file-directory @var{directory}
-Set the directory which @value{GDBN} searches for separate debugging
-information files to @var{directory}.
+@item set debug-file-directory @var{directories}
+Set the directories which @value{GDBN} searches for separate debugging
+information files to @var{directory}. Multiple directory components can be set
+concatenating them by a directory separator.
@kindex show debug-file-directory
@item show debug-file-directory
-Show the directory @value{GDBN} searches for separate debugging
+Show the directories @value{GDBN} searches for separate debugging
information files.
@end table
@@ -19336,8 +19337,8 @@ readable, @value{GDBN} will evaluate it as a Python script.
If this file does not exist, and if the parameter
@code{debug-file-directory} is set (@pxref{Separate Debug Files}),
-then @value{GDBN} will use the file named
-@file{@var{debug-file-directory}/@var{real-name}}, where
+then @value{GDBN} will use for its each separated directory component
+@code{component} the file named @file{@code{component}/@var{real-name}}, where
@var{real-name} is the object file's real name, as described above.
Finally, if this file does not exist, then @value{GDBN} will look for
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -1218,35 +1218,59 @@ build_id_verify (const char *filename, struct build_id *check)
static char *
build_id_to_debug_filename (struct build_id *build_id)
{
- char *link, *s, *retval = NULL;
- gdb_byte *data = build_id->data;
- size_t size = build_id->size;
+ char *link, *debugdir, *retval = NULL;
/* DEBUG_FILE_DIRECTORY/.build-id/ab/cdef */
- link = xmalloc (strlen (debug_file_directory) + (sizeof "/.build-id/" - 1) + 1
- + 2 * size + (sizeof ".debug" - 1) + 1);
- s = link + sprintf (link, "%s/.build-id/", debug_file_directory);
- if (size > 0)
- {
- size--;
- s += sprintf (s, "%02x", (unsigned) *data++);
- }
- if (size > 0)
- *s++ = '/';
- while (size-- > 0)
- s += sprintf (s, "%02x", (unsigned) *data++);
- strcpy (s, ".debug");
-
- /* lrealpath() is expensive even for the usually non-existent files. */
- if (access (link, F_OK) == 0)
- retval = lrealpath (link);
- xfree (link);
-
- if (retval != NULL && !build_id_verify (retval, build_id))
+ link = alloca (strlen (debug_file_directory) + (sizeof "/.build-id/" - 1) + 1
+ + 2 * build_id->size + (sizeof ".debug" - 1) + 1);
+
+ /* Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will
+ cause "/.build-id/..." lookups. */
+
+ debugdir = debug_file_directory;
+ do
{
- xfree (retval);
- retval = NULL;
+ char *s, *debugdir_end;
+ gdb_byte *data = build_id->data;
+ size_t size = build_id->size;
+
+ while (*debugdir == DIRNAME_SEPARATOR)
+ debugdir++;
+
+ debugdir_end = strchr (debugdir, DIRNAME_SEPARATOR);
+ if (debugdir_end == NULL)
+ debugdir_end = &debugdir[strlen (debugdir)];
+
+ memcpy (link, debugdir, debugdir_end - debugdir);
+ s = &link[debugdir_end - debugdir];
+ s += sprintf (s, "/.build-id/");
+ if (size > 0)
+ {
+ size--;
+ s += sprintf (s, "%02x", (unsigned) *data++);
+ }
+ if (size > 0)
+ *s++ = '/';
+ while (size-- > 0)
+ s += sprintf (s, "%02x", (unsigned) *data++);
+ strcpy (s, ".debug");
+
+ /* lrealpath() is expensive even for the usually non-existent files. */
+ if (access (link, F_OK) == 0)
+ retval = lrealpath (link);
+
+ if (retval != NULL && !build_id_verify (retval, build_id))
+ {
+ xfree (retval);
+ retval = NULL;
+ }
+
+ if (retval != NULL)
+ break;
+
+ debugdir = debugdir_end;
}
+ while (*debugdir != 0);
return retval;
}
@@ -1333,7 +1357,7 @@ static char *
find_separate_debug_file (struct objfile *objfile)
{
asection *sect;
- char *basename, *name_copy;
+ char *basename, *name_copy, *debugdir;
char *dir = NULL;
char *debugfile = NULL;
char *canon_name = NULL;
@@ -1410,29 +1434,51 @@ find_separate_debug_file (struct objfile *objfile)
if (separate_debug_file_exists (debugfile, crc32, objfile->name))
goto cleanup_return_debugfile;
- /* Then try in the global debugfile directory. */
- strcpy (debugfile, debug_file_directory);
- strcat (debugfile, "/");
- strcat (debugfile, dir);
- strcat (debugfile, basename);
-
- if (separate_debug_file_exists (debugfile, crc32, objfile->name))
- goto cleanup_return_debugfile;
+ /* Then try in the global debugfile directories.
+
+ Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will
+ cause "/..." lookups. */
- /* If the file is in the sysroot, try using its base path in the
- global debugfile directory. */
- if (canon_name
- && strncmp (canon_name, gdb_sysroot, strlen (gdb_sysroot)) == 0
- && IS_DIR_SEPARATOR (canon_name[strlen (gdb_sysroot)]))
+ debugdir = debug_file_directory;
+ do
{
- strcpy (debugfile, debug_file_directory);
- strcat (debugfile, canon_name + strlen (gdb_sysroot));
+ char *debugdir_end;
+
+ while (*debugdir == DIRNAME_SEPARATOR)
+ debugdir++;
+
+ debugdir_end = strchr (debugdir, DIRNAME_SEPARATOR);
+ if (debugdir_end == NULL)
+ debugdir_end = &debugdir[strlen (debugdir)];
+
+ memcpy (debugfile, debugdir, debugdir_end - debugdir);
+ debugfile[debugdir_end - debugdir] = 0;
strcat (debugfile, "/");
+ strcat (debugfile, dir);
strcat (debugfile, basename);
if (separate_debug_file_exists (debugfile, crc32, objfile->name))
goto cleanup_return_debugfile;
+
+ /* If the file is in the sysroot, try using its base path in the
+ global debugfile directory. */
+ if (canon_name
+ && strncmp (canon_name, gdb_sysroot, strlen (gdb_sysroot)) == 0
+ && IS_DIR_SEPARATOR (canon_name[strlen (gdb_sysroot)]))
+ {
+ memcpy (debugfile, debugdir, debugdir_end - debugdir);
+ debugfile[debugdir_end - debugdir] = 0;
+ strcat (debugfile, canon_name + strlen (gdb_sysroot));
+ strcat (debugfile, "/");
+ strcat (debugfile, basename);
+
+ if (separate_debug_file_exists (debugfile, crc32, objfile->name))
+ goto cleanup_return_debugfile;
+ }
+
+ debugdir = debugdir_end;
}
+ while (*debugdir != 0);
xfree (debugfile);
debugfile = NULL;
@@ -4173,12 +4219,12 @@ Usage: set extension-language .foo bar"),
add_setshow_optional_filename_cmd ("debug-file-directory", class_support,
&debug_file_directory, _("\
-Set the directory where separate debug symbols are searched for."), _("\
-Show the directory where separate debug symbols are searched for."), _("\
+Set the directories where separate debug symbols are searched for."), _("\
+Show the directories where separate debug symbols are searched for."), _("\
Separate debug symbols are first searched for in the same\n\
directory as the binary, then in the `" DEBUG_SUBDIRECTORY "' subdirectory,\n\
and lastly at the path of the directory of the binary with\n\
-the global debug-file directory prepended."),
+each global debug-file-directory component prepended."),
NULL,
show_debug_file_directory,
&setlist, &showlist);
--- a/gdb/testsuite/gdb.base/sepdebug.exp
+++ b/gdb/testsuite/gdb.base/sepdebug.exp
@@ -995,6 +995,12 @@ if ![string compare $build_id_debug_filename ""] then {
test_different_dir build-id "${objdir}/${subdir}" $xfail
+ # Test also multiple directories can be specified. Without the build-id
+ # reference GDB would find the separate debug info just at the same
+ # location as the executable file.
+
+ test_different_dir multiple-dirs "/doesnotexist:${objdir}/${subdir}" $xfail
+
# Spare debug files may confuse testsuite runs in the future.
remote_exec build "rm -f ${objdir}/${subdir}/${build_id_debug_filename}"
}

View File

@ -0,0 +1,151 @@
http://sourceware.org/ml/gdb-patches/2009-10/msg00507.html
Subject: [patch 1/3] print the .debug file name having CRC mismatch
Hi,
this patch is left as is from Andrew Cagney.
Thanks,
Jan
gdb/
2005-04-02 Andrew Cagney <cagney@gnu.org>
* symfile.c (separate_debug_file_exists): When the CRCs mismatch
print a warning.
(find_separate_debug_file): Pass in the objfile's name.
gdb/testsuite/
2009-10-21 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/sepdebug.exp (CRC mismatch is reported): New test.
* gdb.base/sepdebug2.c: New file.
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -1283,7 +1283,8 @@ get_debug_link_info (struct objfile *objfile, unsigned long *crc32_out)
}
static int
-separate_debug_file_exists (const char *name, unsigned long crc)
+separate_debug_file_exists (const char *name, unsigned long crc,
+ const char *parent_name)
{
unsigned long file_crc = 0;
bfd *abfd;
@@ -1303,7 +1304,15 @@ separate_debug_file_exists (const char *name, unsigned long crc)
bfd_close (abfd);
- return crc == file_crc;
+ if (crc != file_crc)
+ {
+ warning (_("the debug information found in \"%s\""
+ " does not match \"%s\" (CRC mismatch).\n"),
+ name, parent_name);
+ return 0;
+ }
+
+ return 1;
}
char *debug_file_directory = NULL;
@@ -1355,6 +1364,8 @@ find_separate_debug_file (struct objfile *objfile)
basename = get_debug_link_info (objfile, &crc32);
if (basename == NULL)
+ /* There's no separate debug info, hence there's no way we could
+ load it => no warning. */
return NULL;
dir = xstrdup (objfile->name);
@@ -1388,7 +1399,7 @@ find_separate_debug_file (struct objfile *objfile)
strcpy (debugfile, dir);
strcat (debugfile, basename);
- if (separate_debug_file_exists (debugfile, crc32))
+ if (separate_debug_file_exists (debugfile, crc32, objfile->name))
{
xfree (basename);
xfree (dir);
@@ -1402,7 +1413,7 @@ find_separate_debug_file (struct objfile *objfile)
strcat (debugfile, "/");
strcat (debugfile, basename);
- if (separate_debug_file_exists (debugfile, crc32))
+ if (separate_debug_file_exists (debugfile, crc32, objfile->name))
{
xfree (basename);
xfree (dir);
@@ -1416,7 +1427,7 @@ find_separate_debug_file (struct objfile *objfile)
strcat (debugfile, dir);
strcat (debugfile, basename);
- if (separate_debug_file_exists (debugfile, crc32))
+ if (separate_debug_file_exists (debugfile, crc32, objfile->name))
{
xfree (basename);
xfree (dir);
@@ -1435,7 +1446,7 @@ find_separate_debug_file (struct objfile *objfile)
strcat (debugfile, "/");
strcat (debugfile, basename);
- if (separate_debug_file_exists (debugfile, crc32))
+ if (separate_debug_file_exists (debugfile, crc32, objfile->name))
{
xfree (canon_name);
xfree (basename);
--- a/gdb/testsuite/gdb.base/sepdebug.exp
+++ b/gdb/testsuite/gdb.base/sepdebug.exp
@@ -952,6 +952,23 @@ set debugfile "${objdir}/${subdir}/${testfile}.debug"
test_different_dir debuglink "${objdir}/${subdir}" 0
+# Test CRC mismatch is reported.
+
+if {[build_executable sepdebug.exp sepdebug2 sepdebug2.c debug] != -1
+ && ![gdb_gnu_strip_debug ${objdir}/${subdir}/sepdebug2]} {
+
+ remote_exec build "cp ${debugfile} ${objdir}/${subdir}/.debug/sepdebug2.debug"
+
+ gdb_exit
+ gdb_start
+ gdb_reinitialize_dir $srcdir/$subdir
+
+ set escapedobjdirsubdir [string_to_regexp ${objdir}/${subdir}]
+
+ gdb_test "file ${objdir}/${subdir}/sepdebug2" "warning: the debug information found in \"${escapedobjdirsubdir}/\\.debug/sepdebug2\\.debug\" does not match \"${escapedobjdirsubdir}/sepdebug2\" \\(CRC mismatch\\)\\..*\\(no debugging symbols found\\).*" "CRC mismatch is reported"
+}
+
+
# NT_GNU_BUILD_ID / .note.gnu.build-id test:
set build_id_debug_filename [build_id_debug_filename_get $binfile]
--- /dev/null
+++ b/gdb/testsuite/gdb.base/sepdebug2.c
@@ -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 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/>. */
+
+int
+main (void)
+{
+ return 0;
+}

View File

@ -0,0 +1,115 @@
https://bugzilla.redhat.com/show_bug.cgi?id=533176#c4
I find it a bug in DWARF and gdb behaves correctly according to it. From the
current DWARF's point of view the is a function call which you skip by "next".
If you hide any /usr/lib/debug such as using:
gdb -nx -ex 'set debug-file-directory /qwe' -ex 'file ./tpcommon_gfortran44'
and use "step" command instead of "next" there it will work.
(You need to hide debuginfo from libgomp as you would step into libgomp sources
to maintain the threads for execution.)
There should be some DWARF extension for it, currently tried to detect
substring ".omp_fn." as this function is called "MAIN__.omp_fn.0" and do not
consider such sub-function as a skippable by "next".
Another problem is that with "set scheduler-locking" being "off" (default
upstream) or "step" (default in F/RHEL) the simultaneous execution of the
threads is inconvenient. Setting it to "on" will lockup the debugging as the
threads need to get synchronized at some point. This is a more general
debugging problem of GOMP outside of the scope of this Bug.
--- ./gdb/infrun.c 2009-12-09 22:03:33.000000000 +0100
+++ ./gdb/infrun.c 2009-12-09 22:29:56.000000000 +0100
@@ -3994,6 +3994,12 @@ infrun: not switching back to stepped th
if (ecs->event_thread->step_over_calls == STEP_OVER_ALL)
{
+ struct symbol *stop_fn = find_pc_function (stop_pc);
+
+ if (stop_fn == NULL
+ || strstr (SYMBOL_LINKAGE_NAME (stop_fn), ".omp_fn.") == NULL)
+{ /* ".omp_fn." */
+
/* We're doing a "next".
Normal (forward) execution: set a breakpoint at the
@@ -4020,6 +4026,7 @@ infrun: not switching back to stepped th
keep_going (ecs);
return;
+} /* ".omp_fn." */
}
/* If we are in a function call trampoline (a stub between the
--- ./gdb/testsuite/gdb.fortran/omp-step.exp 1970-01-01 01:00:00.000000000 +0100
+++ ./gdb/testsuite/gdb.fortran/omp-step.exp 2009-12-09 22:31:04.000000000 +0100
@@ -0,0 +1,31 @@
+# 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/>.
+
+set testfile "omp-step"
+set srcfile ${testfile}.f90
+if { [prepare_for_testing $testfile.exp $testfile $srcfile {debug f77 additional_flags=-fopenmp}] } {
+ return -1
+}
+
+if ![runto [gdb_get_line_number "start-here"]] {
+ perror "Couldn't run to start-here"
+ return 0
+}
+
+gdb_test "next" {!\$omp parallel} "step closer"
+gdb_test "next" {a\(omp_get_thread_num\(\) \+ 1\) = 1} "step into omp"
+
+gdb_breakpoint [gdb_get_line_number "success"]
+gdb_continue_to_breakpoint "success" ".*success.*"
--- ./gdb/testsuite/gdb.fortran/omp-step.f90 1970-01-01 01:00:00.000000000 +0100
+++ ./gdb/testsuite/gdb.fortran/omp-step.f90 2009-12-09 22:25:35.000000000 +0100
@@ -0,0 +1,32 @@
+! 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/>.
+
+ use omp_lib
+ integer nthreads, i, a(1000)
+ nthreads = omp_get_num_threads()
+ if (nthreads .gt. 1000) call abort
+
+ do i = 1, nthreads
+ a(i) = 0
+ end do
+ print *, "start-here"
+!$omp parallel
+ a(omp_get_thread_num() + 1) = 1
+!$omp end parallel
+ do i = 1, nthreads
+ if (a(i) .ne. 1) call abort
+ end do
+ print *, "success"
+ end

View File

@ -0,0 +1,317 @@
http://sourceware.org/ml/gdb-patches/2009-12/msg00180.html
Subject: [patch] Fix a regression by me on breakpoint-cond-infcall
Hi,
GDB has now a regression since:
Re: [patch] Performance optimize large bp_location count
http://sourceware.org/ml/gdb-patches/2009-10/msg00632.html
=
2009-10-25 Jan Kratochvil <jan.kratochvil@redhat.com>
Performance optimize large bp_location count.
on breakpoints with conditions calling inferior.
Bringing the code back to the state before my acceleration patch.
The code before already assumed no breakpoints or their bp_locations can
change across the inferior call which should be true - trying to do some:
break a if b()
break b
command 1
delete 2
end
or similar cannot work as inside "if b()" evaluation no breakpoints can be
added or removed.
update_global_location_list also does not removed/add `struct bp_location's
themselves but only pointers to them in the bp_location array. As the new
iteration no longer uses the bp_location array it is no longer a problem.
Original problem was found by and fixed differently by Phil Muldoon.
No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
Thanks,
Jan
gdb/
2009-12-13 Jan Kratochvil <jan.kratochvil@redhat.com>
* breakpoint.c (bpstat_stop_status): Iterate using ALL_BREAKPOINTS and
the B->LOC list. Remove gdb_assert on B. Change bp_hardware_watchpoint
continue to break. Remove variable update_locations. Remove HIT_COUNT
increment protection by an ENABLE_STATE check. Inline the delayed
update_global_location_list call.
gdb/testsuite/
2009-12-13 Jan Kratochvil <jan.kratochvil@redhat.com>
Phil Muldoon <pmuldoon@redhat.com>
* gdb.base/condbreak.exp: Put breakpoint on marker3 and marker4.
(bp_location13, bp_location14, bp_location17, bp_location18)
(marker3_proto, marker4_proto): New variables.
(breakpoint info): Update output.
(run until breakpoint at marker3, run until breakpoint at marker4): New
tests.
[ Backported for F-12. ]
--- ./gdb/breakpoint.c 2009-12-14 00:25:55.000000000 +0100
+++ ./gdb/breakpoint.c 2009-12-14 00:32:32.000000000 +0100
@@ -3298,93 +3298,93 @@ bpstat_stop_status (CORE_ADDR bp_addr, p
/* Pointer to the last thing in the chain currently. */
bpstat bs = root_bs;
int ix;
- int need_remove_insert, update_locations = 0;
+ int need_remove_insert;
- ALL_BP_LOCATIONS (bl, blp_tmp)
- {
- bpstat bs_prev = bs;
+ /* ALL_BP_LOCATIONS iteration would break across
+ update_global_location_list possibly executed by
+ bpstat_check_breakpoint_conditions's inferior call. */
- b = bl->owner;
- gdb_assert (b);
- if (!breakpoint_enabled (b) && b->enable_state != bp_permanent)
- continue;
-
- /* For hardware watchpoints, we look only at the first location.
- The watchpoint_check function will work on entire expression,
- not the individual locations. For read watchopints, the
- watchpoints_triggered function have checked all locations
- alrea
- */
- if (b->type == bp_hardware_watchpoint && bl != b->loc)
- continue;
-
- if (!bpstat_check_location (bl, bp_addr))
- continue;
-
- /* Come here if it's a watchpoint, or if the break address matches */
-
- bs = bpstat_alloc (bl, bs); /* Alloc a bpstat to explain stop */
- gdb_assert (bs_prev->next == bs);
-
- /* Assume we stop. Should we find watchpoint that is not actually
- triggered, or if condition of breakpoint is false, we'll reset
- 'stop' to 0. */
- bs->stop = 1;
- bs->print = 1;
+ ALL_BREAKPOINTS (b)
+ {
+ if (!breakpoint_enabled (b) && b->enable_state != bp_permanent)
+ continue;
- if (!bpstat_check_watchpoint (bs))
- {
- /* Ensure bpstat_explains_signal stays false if this BL could not be
- the cause of this trap. */
+ for (bl = b->loc; bl != NULL; bl = bl->next)
+ {
+ bpstat bs_prev = bs;
+
+ /* For hardware watchpoints, we look only at the first location.
+ The watchpoint_check function will work on entire expression,
+ not the individual locations. For read watchopints, the
+ watchpoints_triggered function have checked all locations
+ alrea
+ */
+ if (b->type == bp_hardware_watchpoint && bl != b->loc)
+ break;
- gdb_assert (bs->print_it == print_it_noop);
- gdb_assert (!bs->stop);
- xfree (bs);
- bs = bs_prev;
- bs->next = NULL;
- continue;
- }
+ if (!bpstat_check_location (bl, bp_addr))
+ continue;
- if (b->type == bp_thread_event || b->type == bp_overlay_event
- || b->type == bp_longjmp_master || b->type == bp_exception_master)
- /* We do not stop for these. */
- bs->stop = 0;
- else
- bpstat_check_breakpoint_conditions (bs, ptid);
-
- if (bs->stop)
- {
- if (b->enable_state != bp_disabled)
- ++(b->hit_count);
+ /* Come here if it's a watchpoint, or if the break address matches */
- /* We will stop here */
- if (b->disposition == disp_disable)
- {
- if (b->enable_state != bp_permanent)
- b->enable_state = bp_disabled;
- update_locations = 1;
- }
- if (b->silent)
- bs->print = 0;
- bs->commands = b->commands;
- if (bs->commands
- && (strcmp ("silent", bs->commands->line) == 0
- || (xdb_commands && strcmp ("Q", bs->commands->line) == 0)))
- {
- bs->commands = bs->commands->next;
- bs->print = 0;
- }
- bs->commands = copy_command_lines (bs->commands);
- }
+ bs = bpstat_alloc (bl, bs); /* Alloc a bpstat to explain stop */
+ gdb_assert (bs_prev->next == bs);
- /* Print nothing for this entry if we dont stop or if we dont print. */
- if (bs->stop == 0 || bs->print == 0)
- bs->print_it = print_it_noop;
- }
+ /* Assume we stop. Should we find watchpoint that is not actually
+ triggered, or if condition of breakpoint is false, we'll reset
+ 'stop' to 0. */
+ bs->stop = 1;
+ bs->print = 1;
- /* Delay this call which would break the ALL_BP_LOCATIONS iteration above. */
- if (update_locations)
- update_global_location_list (0);
+ if (!bpstat_check_watchpoint (bs))
+ {
+ /* Ensure bpstat_explains_signal stays false if this BL could not be
+ the cause of this trap. */
+
+ gdb_assert (bs->print_it == print_it_noop);
+ gdb_assert (!bs->stop);
+ xfree (bs);
+ bs = bs_prev;
+ bs->next = NULL;
+ continue;
+ }
+
+ if (b->type == bp_thread_event || b->type == bp_overlay_event
+ || b->type == bp_longjmp_master || b->type == bp_exception_master)
+ /* We do not stop for these. */
+ bs->stop = 0;
+ else
+ bpstat_check_breakpoint_conditions (bs, ptid);
+
+ if (bs->stop)
+ {
+ ++(b->hit_count);
+
+ /* We will stop here */
+ if (b->disposition == disp_disable)
+ {
+ if (b->enable_state != bp_permanent)
+ b->enable_state = bp_disabled;
+ update_global_location_list (0);
+ }
+ if (b->silent)
+ bs->print = 0;
+ bs->commands = b->commands;
+ if (bs->commands
+ && (strcmp ("silent", bs->commands->line) == 0
+ || (xdb_commands && strcmp ("Q", bs->commands->line) == 0)))
+ {
+ bs->commands = bs->commands->next;
+ bs->print = 0;
+ }
+ bs->commands = copy_command_lines (bs->commands);
+ }
+
+ /* Print nothing for this entry if we dont stop or if we dont print. */
+ if (bs->stop == 0 || bs->print == 0)
+ bs->print_it = print_it_noop;
+ }
+ }
for (ix = 0; VEC_iterate (bp_location_p, moribund_locations, ix, loc); ++ix)
{
--- ./gdb/testsuite/gdb.base/condbreak.exp 2009-01-03 06:58:03.000000000 +0100
+++ ./gdb/testsuite/gdb.base/condbreak.exp 2009-12-14 00:27:21.000000000 +0100
@@ -68,8 +68,12 @@ set bp_location1 [gdb_get_line_number "
set bp_location6 [gdb_get_line_number "set breakpoint 6 here"]
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_location13 [gdb_get_line_number "set breakpoint 13 here" $srcfile1]
+set bp_location14 [gdb_get_line_number "set breakpoint 14 here" $srcfile1]
set bp_location15 [gdb_get_line_number "set breakpoint 15 here" $srcfile1]
set bp_location16 [gdb_get_line_number "set breakpoint 16 here" $srcfile1]
+set bp_location17 [gdb_get_line_number "set breakpoint 17 here" $srcfile1]
+set bp_location18 [gdb_get_line_number "set breakpoint 18 here" $srcfile1]
#
# test break at function
@@ -110,15 +114,29 @@ gdb_test "break marker2 if (a==43)" \
"Breakpoint.*at.* file .*$srcfile1, line.*"
#
+# Check break involving inferior function call.
+# Ensure there is at least one additional breakpoint with higher VMA.
+#
+gdb_test "break marker3 if (multi_line_if_conditional(1,1,1)==0)" \
+ "Breakpoint.*at.* file .*$srcfile1, line.*"
+gdb_test "break marker4" \
+ "Breakpoint.*at.* file .*$srcfile1, line.*"
+
+#
# check to see what breakpoints are set
#
if {$hp_aCC_compiler} {
set marker1_proto "\\(void\\)"
set marker2_proto "\\(int\\)"
+ # Not checked.
+ set marker3_proto "\\(char \\*, char \\*\\)"
+ set marker4_proto "\\(long\\)"
} else {
set marker1_proto ""
set marker2_proto ""
+ set marker3_proto ""
+ set marker4_proto ""
}
gdb_test "info break" \
@@ -129,7 +147,10 @@ gdb_test "info break" \
\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location1.*
\[\t \]+stop only if \\(1==1\\).*
\[0-9\]+\[\t \]+breakpoint keep y.* in marker2$marker2_proto at .*$srcfile1:($bp_location8|$bp_location9).*
-\[\t \]+stop only if \\(a==43\\).*" \
+\[\t \]+stop only if \\(a==43\\).*
+\[0-9\]+\[\t \]+breakpoint keep y.* in marker3$marker3_proto at .*$srcfile1:($bp_location17|$bp_location18).*
+\[\t \]+stop only if \\(multi_line_if_conditional\\(1,1,1\\)==0\\).*
+\[0-9\]+\[\t \]+breakpoint keep y.* in marker4$marker4_proto at .*$srcfile1:($bp_location13|$bp_location14).*" \
"breakpoint info"
@@ -220,3 +241,23 @@ gdb_expect {
fail "(timeout) run until breakpoint at marker2"
}
}
+
+set test "run until breakpoint at marker3"
+gdb_test_multiple "continue" $test {
+ -re "Continuing\\..*Breakpoint \[0-9\]+, marker3 \\(a=$hex \"stack\", b=$hex \"trace\"\\) at .*$srcfile1:($bp_location17|$bp_location18).*($bp_location17|$bp_location18)\[\t \]+.*$gdb_prompt $" {
+ pass $test
+ }
+ -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker3 \\(a=$hex \"stack\", b=$hex \"trace\"\\) at .*$srcfile1:($bp_location17|$bp_location18).*($bp_location17|$bp_location18)\[\t \]+.*$gdb_prompt $" {
+ xfail $test
+ }
+}
+
+set test "run until breakpoint at marker4"
+gdb_test_multiple "continue" $test {
+ -re "Continuing\\..*Breakpoint \[0-9\]+, marker4 \\(d=177601976\\) at .*$srcfile1:($bp_location13|$bp_location14).*($bp_location13|$bp_location14)\[\t \]+.*$gdb_prompt $" {
+ pass $test
+ }
+ -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker4 \\(d=177601976\\) at .*$srcfile1:($bp_location13|$bp_location14).*($bp_location13|$bp_location14)\[\t \]+.*$gdb_prompt $" {
+ xfail $test
+ }
+}

View File

@ -0,0 +1,14 @@
--- ./gdb/breakpoint.c 2010-04-26 02:35:53.000000000 +0200
+++ ./gdb/breakpoint.c 2010-04-26 02:33:26.000000000 +0200
@@ -8499,6 +8499,11 @@ update_breakpoint_locations (struct brea
{
struct gdb_exception e;
+ /* Temporary workaround before the non-intrusive ifunc patch gets in.
+ exp parsing can now call inferior function invalidating
+ EXISTING_LOCATIONS. */
+ existing_locations = NULL;
+
s = b->cond_string;
TRY_CATCH (e, RETURN_MASK_ERROR)
{

View File

@ -0,0 +1,974 @@
http://sourceware.org/gdb/wiki/ProjectArcher
http://sourceware.org/gdb/wiki/ArcherBranchManagement
GIT snapshot:
commit 791165df07fd22d381def1318954c389a606f81a
archer-jankratochvil-ifunc
Index: gdb-7.0.1/gdb/alpha-linux-tdep.c
===================================================================
--- gdb-7.0.1.orig/gdb/alpha-linux-tdep.c 2009-07-02 19:25:52.000000000 +0200
+++ gdb-7.0.1/gdb/alpha-linux-tdep.c 2010-01-21 20:45:32.000000000 +0100
@@ -25,6 +25,7 @@
#include "symtab.h"
#include "regset.h"
#include "regcache.h"
+#include "linux-tdep.h"
#include "alpha-tdep.h"
@@ -235,6 +236,9 @@ alpha_linux_init_abi (struct gdbarch_inf
set_gdbarch_regset_from_core_section
(gdbarch, alpha_linux_regset_from_core_section);
+
+ set_gdbarch_convert_from_func_ptr_addr (gdbarch,
+ linux_convert_from_func_ptr_addr);
}
/* Provide a prototype to silence -Wmissing-prototypes. */
Index: gdb-7.0.1/gdb/amd64-linux-tdep.c
===================================================================
--- gdb-7.0.1.orig/gdb/amd64-linux-tdep.c 2010-01-21 20:45:22.000000000 +0100
+++ gdb-7.0.1/gdb/amd64-linux-tdep.c 2010-01-21 20:45:32.000000000 +0100
@@ -1557,6 +1557,9 @@ amd64_linux_init_abi (struct gdbarch_inf
amd64_linux_record_tdep.arg6 = AMD64_R9_REGNUM;
tdep->i386_syscall_record = amd64_linux_syscall_record;
+
+ set_gdbarch_convert_from_func_ptr_addr (gdbarch,
+ linux_convert_from_func_ptr_addr);
}
Index: gdb-7.0.1/gdb/arm-linux-tdep.c
===================================================================
--- gdb-7.0.1.orig/gdb/arm-linux-tdep.c 2009-07-31 01:05:03.000000000 +0200
+++ gdb-7.0.1/gdb/arm-linux-tdep.c 2010-01-21 20:45:32.000000000 +0100
@@ -873,6 +873,9 @@ arm_linux_init_abi (struct gdbarch_info
set_gdbarch_displaced_step_free_closure (gdbarch,
simple_displaced_step_free_closure);
set_gdbarch_displaced_step_location (gdbarch, displaced_step_at_entry_point);
+
+ set_gdbarch_convert_from_func_ptr_addr (gdbarch,
+ linux_convert_from_func_ptr_addr);
}
/* Provide a prototype to silence -Wmissing-prototypes. */
Index: gdb-7.0.1/gdb/elfread.c
===================================================================
--- gdb-7.0.1.orig/gdb/elfread.c 2010-01-21 20:45:21.000000000 +0100
+++ gdb-7.0.1/gdb/elfread.c 2010-01-21 20:46:30.000000000 +0100
@@ -168,7 +168,8 @@ record_minimal_symbol (char *name, CORE_
{
struct gdbarch *gdbarch = get_objfile_arch (objfile);
- if (ms_type == mst_text || ms_type == mst_file_text)
+ if (ms_type == mst_text || ms_type == mst_file_text
+ || ms_type == mst_text_gnu_ifunc)
address = gdbarch_smash_text_address (gdbarch, address);
return prim_record_minimal_symbol_and_info
@@ -373,7 +374,10 @@ elf_symtab_read (struct objfile *objfile
{
if (sym->flags & (BSF_GLOBAL | BSF_WEAK))
{
- ms_type = mst_text;
+ if (sym->flags & BSF_GNU_INDIRECT_FUNCTION)
+ ms_type = mst_text_gnu_ifunc;
+ else
+ ms_type = mst_text;
}
else if ((sym->name[0] == '.' && sym->name[1] == 'L')
|| ((sym->flags & BSF_LOCAL)
Index: gdb-7.0.1/gdb/frv-linux-tdep.c
===================================================================
--- gdb-7.0.1.orig/gdb/frv-linux-tdep.c 2009-07-02 19:25:53.000000000 +0200
+++ gdb-7.0.1/gdb/frv-linux-tdep.c 2010-01-21 20:45:32.000000000 +0100
@@ -31,6 +31,7 @@
#include "frame-unwind.h"
#include "regset.h"
#include "gdb_string.h"
+#include "linux-tdep.h"
/* Define the size (in bytes) of an FR-V instruction. */
static const int frv_instr_size = 4;
@@ -485,7 +486,21 @@ frv_linux_regset_from_core_section (stru
return NULL;
}
-
+static CORE_ADDR
+frv_linux_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
+ CORE_ADDR addr,
+ struct target_ops *targ)
+{
+ CORE_ADDR pc = frv_convert_from_func_ptr_addr (gdbarch, addr, targ);
+ CORE_ADDR resolved;
+
+ resolved = linux_convert_from_func_and_ptr (gdbarch, addr, pc);
+ if (resolved != pc)
+ pc = frv_convert_from_func_ptr_addr (gdbarch, resolved, targ);
+
+ return pc;
+}
+
static void
frv_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
@@ -493,6 +508,10 @@ frv_linux_init_abi (struct gdbarch_info
frame_unwind_append_unwinder (gdbarch, &frv_linux_sigtramp_frame_unwind);
set_gdbarch_regset_from_core_section (gdbarch,
frv_linux_regset_from_core_section);
+
+ if (frv_abi (gdbarch) == FRV_ABI_FDPIC)
+ set_gdbarch_convert_from_func_ptr_addr (gdbarch,
+ frv_linux_convert_from_func_ptr_addr);
}
static enum gdb_osabi
Index: gdb-7.0.1/gdb/frv-tdep.c
===================================================================
--- gdb-7.0.1.orig/gdb/frv-tdep.c 2009-07-02 19:25:53.000000000 +0200
+++ gdb-7.0.1/gdb/frv-tdep.c 2010-01-21 20:45:32.000000000 +0100
@@ -1169,7 +1169,7 @@ find_func_descr (struct gdbarch *gdbarch
return descr;
}
-static CORE_ADDR
+CORE_ADDR
frv_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr,
struct target_ops *targ)
{
Index: gdb-7.0.1/gdb/frv-tdep.h
===================================================================
--- gdb-7.0.1.orig/gdb/frv-tdep.h 2009-01-03 06:57:51.000000000 +0100
+++ gdb-7.0.1/gdb/frv-tdep.h 2010-01-21 20:45:32.000000000 +0100
@@ -118,3 +118,6 @@ CORE_ADDR frv_fetch_objfile_link_map (st
struct target_so_ops;
extern struct target_so_ops frv_so_ops;
+CORE_ADDR frv_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
+ CORE_ADDR addr,
+ struct target_ops *targ);
Index: gdb-7.0.1/gdb/gdbtypes.c
===================================================================
--- gdb-7.0.1.orig/gdb/gdbtypes.c 2010-01-21 20:45:22.000000000 +0100
+++ gdb-7.0.1/gdb/gdbtypes.c 2010-01-21 20:45:32.000000000 +0100
@@ -1904,6 +1904,8 @@ init_type (enum type_code code, int leng
TYPE_NOTTEXT (type) = 1;
if (flags & TYPE_FLAG_FIXED_INSTANCE)
TYPE_FIXED_INSTANCE (type) = 1;
+ if (flags & TYPE_FLAG_GNU_IFUNC)
+ TYPE_GNU_IFUNC (type) = 1;
if (name)
TYPE_NAME (type) = obsavestring (name, strlen (name),
@@ -3762,6 +3764,8 @@ gdbtypes_post_init (struct gdbarch *gdba
= lookup_pointer_type (builtin_type->builtin_void);
builtin_type->builtin_func_ptr
= lookup_pointer_type (lookup_function_type (builtin_type->builtin_void));
+ builtin_type->builtin_func_func
+ = lookup_function_type (builtin_type->builtin_func_ptr);
/* This type represents a GDB internal function. */
builtin_type->internal_fn
@@ -3878,6 +3882,11 @@ objfile_type (struct objfile *objfile)
"<text variable, no debug info>", objfile);
TYPE_TARGET_TYPE (objfile_type->nodebug_text_symbol)
= objfile_type->builtin_int;
+ objfile_type->nodebug_text_gnu_ifunc_symbol
+ = init_type (TYPE_CODE_FUNC, 1, TYPE_FLAG_GNU_IFUNC,
+ "<text gnu-ifunc variable, no debug info>", objfile);
+ TYPE_TARGET_TYPE (objfile_type->nodebug_text_gnu_ifunc_symbol)
+ = objfile_type->nodebug_text_symbol;
objfile_type->nodebug_data_symbol
= init_type (TYPE_CODE_INT,
gdbarch_int_bit (gdbarch) / HOST_CHAR_BIT, 0,
Index: gdb-7.0.1/gdb/gdbtypes.h
===================================================================
--- gdb-7.0.1.orig/gdb/gdbtypes.h 2010-01-21 20:45:23.000000000 +0100
+++ gdb-7.0.1/gdb/gdbtypes.h 2010-01-21 20:45:32.000000000 +0100
@@ -187,6 +187,7 @@ enum type_flag_value
TYPE_FLAG_FIXED_INSTANCE = (1 << 15),
TYPE_FLAG_STUB_SUPPORTED = (1 << 16),
TYPE_FLAG_NOTTEXT = (1 << 17),
+ TYPE_FLAG_GNU_IFUNC = (1 << 18),
/* Used for error-checking. */
TYPE_FLAG_MIN = TYPE_FLAG_UNSIGNED
@@ -292,6 +293,12 @@ enum type_instance_flag_value
#define TYPE_NOTTEXT(t) (TYPE_MAIN_TYPE (t)->flag_nottext)
+/* Currently used only for TYPE_CODE_FUNC where specifies the real function
+ address is returned by this function call. TYPE_TARGET_TYPE determines the
+ final returned function type to be presented to user. */
+
+#define TYPE_GNU_IFUNC(t) (TYPE_MAIN_TYPE (t)->flag_gnu_ifunc)
+
/* Type owner. If TYPE_OBJFILE_OWNED is true, the type is owned by
the objfile retrieved as TYPE_OBJFILE. Otherweise, the type is
owned by an architecture; TYPE_OBJFILE is NULL in this case. */
@@ -427,6 +434,7 @@ struct main_type
unsigned int flag_vector : 1;
unsigned int flag_stub_supported : 1;
unsigned int flag_nottext : 1;
+ unsigned int flag_gnu_ifunc : 1;
unsigned int flag_fixed_instance : 1;
unsigned int flag_objfile_owned : 1;
unsigned int flag_discardable : 1;
@@ -1144,6 +1152,10 @@ struct builtin_type
(*) () can server as a generic function pointer. */
struct type *builtin_func_ptr;
+ /* `function returning pointer to function (returning void)' type.
+ The final void return type is not significant for it. */
+ struct type *builtin_func_func;
+
/* Special-purpose types. */
@@ -1186,6 +1198,7 @@ struct objfile_type
/* Types used for symbols with no debug information. */
struct type *nodebug_text_symbol;
+ struct type *nodebug_text_gnu_ifunc_symbol;
struct type *nodebug_data_symbol;
struct type *nodebug_unknown_symbol;
struct type *nodebug_tls_symbol;
Index: gdb-7.0.1/gdb/hppa-linux-tdep.c
===================================================================
--- gdb-7.0.1.orig/gdb/hppa-linux-tdep.c 2009-07-02 19:25:54.000000000 +0200
+++ gdb-7.0.1/gdb/hppa-linux-tdep.c 2010-01-21 20:45:32.000000000 +0100
@@ -31,6 +31,7 @@
#include "regset.h"
#include "regcache.h"
#include "hppa-tdep.h"
+#include "linux-tdep.h"
#include "elf/common.h"
@@ -512,7 +513,21 @@ hppa_linux_regset_from_core_section (str
return NULL;
}
-
+
+static CORE_ADDR
+hppa32_linux_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
+ CORE_ADDR addr,
+ struct target_ops *targ)
+{
+ CORE_ADDR pc = hppa32_convert_from_func_ptr_addr (gdbarch, addr, targ);
+ CORE_ADDR resolved;
+
+ resolved = linux_convert_from_func_and_ptr (gdbarch, addr, pc);
+ if (resolved != pc)
+ pc = hppa32_convert_from_func_ptr_addr (gdbarch, resolved, targ);
+
+ return pc;
+}
/* Forward declarations. */
extern initialize_file_ftype _initialize_hppa_linux_tdep;
@@ -554,6 +569,10 @@ hppa_linux_init_abi (struct gdbarch_info
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
svr4_fetch_objfile_link_map);
+
+ if (tdep->bytes_per_address == 4)
+ set_gdbarch_convert_from_func_ptr_addr (gdbarch,
+ hppa32_linux_convert_from_func_ptr_addr);
}
void
Index: gdb-7.0.1/gdb/hppa-tdep.c
===================================================================
--- gdb-7.0.1.orig/gdb/hppa-tdep.c 2009-09-13 18:28:28.000000000 +0200
+++ gdb-7.0.1/gdb/hppa-tdep.c 2010-01-21 20:45:32.000000000 +0100
@@ -1247,7 +1247,7 @@ hppa64_return_value (struct gdbarch *gdb
}
-static CORE_ADDR
+CORE_ADDR
hppa32_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr,
struct target_ops *targ)
{
Index: gdb-7.0.1/gdb/hppa-tdep.h
===================================================================
--- gdb-7.0.1.orig/gdb/hppa-tdep.h 2009-07-02 19:25:54.000000000 +0200
+++ gdb-7.0.1/gdb/hppa-tdep.h 2010-01-21 20:45:32.000000000 +0100
@@ -246,4 +246,8 @@ extern int hppa_in_solib_call_trampoline
CORE_ADDR pc, char *name);
extern CORE_ADDR hppa_skip_trampoline_code (struct frame_info *, CORE_ADDR pc);
+extern CORE_ADDR hppa32_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
+ CORE_ADDR addr,
+ struct target_ops *targ);
+
#endif /* hppa-tdep.h */
Index: gdb-7.0.1/gdb/i386-linux-tdep.c
===================================================================
--- gdb-7.0.1.orig/gdb/i386-linux-tdep.c 2009-09-21 08:57:03.000000000 +0200
+++ gdb-7.0.1/gdb/i386-linux-tdep.c 2010-01-21 20:45:32.000000000 +0100
@@ -798,6 +798,9 @@ i386_linux_init_abi (struct gdbarch_info
i386_linux_get_syscall_number);
set_gdbarch_get_siginfo_type (gdbarch, linux_get_siginfo_type);
+
+ set_gdbarch_convert_from_func_ptr_addr (gdbarch,
+ linux_convert_from_func_ptr_addr);
}
/* Provide a prototype to silence -Wmissing-prototypes. */
Index: gdb-7.0.1/gdb/ia64-linux-tdep.c
===================================================================
--- gdb-7.0.1.orig/gdb/ia64-linux-tdep.c 2009-07-02 19:25:55.000000000 +0200
+++ gdb-7.0.1/gdb/ia64-linux-tdep.c 2010-01-21 20:45:32.000000000 +0100
@@ -26,6 +26,7 @@
#include "osabi.h"
#include "solib-svr4.h"
#include "symtab.h"
+#include "linux-tdep.h"
/* The sigtramp code is in a non-readable (executable-only) region
of memory called the ``gate page''. The addresses in question
@@ -139,6 +140,9 @@ ia64_linux_init_abi (struct gdbarch_info
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
svr4_fetch_objfile_link_map);
+
+ set_gdbarch_convert_from_func_ptr_addr (gdbarch,
+ linux_convert_from_func_ptr_addr);
}
/* Provide a prototype to silence -Wmissing-prototypes. */
Index: gdb-7.0.1/gdb/infcall.c
===================================================================
--- gdb-7.0.1.orig/gdb/infcall.c 2010-01-21 20:45:21.000000000 +0100
+++ gdb-7.0.1/gdb/infcall.c 2010-01-21 20:45:32.000000000 +0100
@@ -252,9 +252,17 @@ find_function_addr (struct value *functi
if (TYPE_CODE (ftype) == TYPE_CODE_FUNC
|| TYPE_CODE (ftype) == TYPE_CODE_METHOD)
{
- funaddr = gdbarch_convert_from_func_ptr_addr (gdbarch, funaddr,
- &current_target);
- value_type = TYPE_TARGET_TYPE (ftype);
+ CORE_ADDR funaddr2;
+
+ funaddr2 = gdbarch_convert_from_func_ptr_addr (gdbarch, funaddr,
+ &current_target);
+
+ /* If TYPE_GNU_IFUNC is currently not resolvable keep its type. */
+ if (funaddr2 != funaddr || !TYPE_GNU_IFUNC (ftype))
+ {
+ funaddr = funaddr2;
+ value_type = TYPE_TARGET_TYPE (ftype);
+ }
}
}
else if (code == TYPE_CODE_INT)
Index: gdb-7.0.1/gdb/linux-tdep.c
===================================================================
--- gdb-7.0.1.orig/gdb/linux-tdep.c 2010-01-21 20:45:22.000000000 +0100
+++ gdb-7.0.1/gdb/linux-tdep.c 2010-01-21 20:47:02.000000000 +0100
@@ -20,6 +20,9 @@
#include "defs.h"
#include "gdbtypes.h"
#include "linux-tdep.h"
+#include "value.h"
+#include "infcall.h"
+#include "target.h"
/* This function is suitable for architectures that don't
extend/override the standard siginfo structure. */
@@ -134,3 +136,43 @@ linux_get_siginfo_type (struct gdbarch *
return siginfo_type;
}
+
+/* Call gnu-ifunc to resolve breakpoint at its returned function. */
+
+CORE_ADDR
+linux_convert_from_func_and_ptr (struct gdbarch *gdbarch, CORE_ADDR func_ptr,
+ CORE_ADDR pc)
+{
+ struct type *func_func_type = builtin_type (gdbarch)->builtin_func_func;
+ struct minimal_symbol *msymbol;
+ struct value *function, *address;
+
+ if (!target_has_execution)
+ return pc;
+
+ msymbol = lookup_minimal_symbol_by_pc (func_ptr);
+ if (msymbol == NULL)
+ return pc;
+ if (MSYMBOL_TYPE (msymbol) != mst_text_gnu_ifunc)
+ return pc;
+
+ /* Not at the gnu-ifunc entry point? */
+ if (SYMBOL_VALUE_ADDRESS (msymbol) != func_ptr)
+ return pc;
+
+ function = allocate_value (func_func_type);
+ set_value_address (function, pc);
+
+ /* gnu-ifuncs have no arguments. FUNCTION is the code instruction address
+ while ADDRESS is a function descriptor. */
+ address = call_function_by_hand (function, 0, NULL);
+
+ return value_as_address (address);
+}
+
+CORE_ADDR
+linux_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr,
+ struct target_ops *targ)
+{
+ return linux_convert_from_func_and_ptr (gdbarch, addr, addr);
+}
Index: gdb-7.0.1/gdb/linux-tdep.h
===================================================================
--- gdb-7.0.1.orig/gdb/linux-tdep.h 2009-02-06 23:59:00.000000000 +0100
+++ gdb-7.0.1/gdb/linux-tdep.h 2010-01-21 20:45:32.000000000 +0100
@@ -22,4 +22,11 @@
struct type *linux_get_siginfo_type (struct gdbarch *);
+CORE_ADDR linux_convert_from_func_and_ptr (struct gdbarch *gdbarch,
+ CORE_ADDR func_ptr, CORE_ADDR pc);
+
+CORE_ADDR linux_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
+ CORE_ADDR addr,
+ struct target_ops *targ);
+
#endif /* linux-tdep.h */
Index: gdb-7.0.1/gdb/m32r-linux-tdep.c
===================================================================
--- gdb-7.0.1.orig/gdb/m32r-linux-tdep.c 2009-01-03 06:57:52.000000000 +0100
+++ gdb-7.0.1/gdb/m32r-linux-tdep.c 2010-01-21 20:45:32.000000000 +0100
@@ -30,6 +30,7 @@
#include "gdb_string.h"
#include "glibc-tdep.h"
+#include "linux-tdep.h"
#include "solib-svr4.h"
#include "symtab.h"
@@ -422,6 +423,9 @@ m32r_linux_init_abi (struct gdbarch_info
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
svr4_fetch_objfile_link_map);
+
+ set_gdbarch_convert_from_func_ptr_addr (gdbarch,
+ linux_convert_from_func_ptr_addr);
}
/* Provide a prototype to silence -Wmissing-prototypes. */
Index: gdb-7.0.1/gdb/minsyms.c
===================================================================
--- gdb-7.0.1.orig/gdb/minsyms.c 2010-01-21 20:45:22.000000000 +0100
+++ gdb-7.0.1/gdb/minsyms.c 2010-01-21 20:45:32.000000000 +0100
@@ -331,8 +331,9 @@ lookup_minimal_symbol_text (const char *
msymbol = msymbol->hash_next)
{
if (strcmp (SYMBOL_LINKAGE_NAME (msymbol), name) == 0 &&
- (MSYMBOL_TYPE (msymbol) == mst_text ||
- MSYMBOL_TYPE (msymbol) == mst_file_text))
+ (MSYMBOL_TYPE (msymbol) == mst_text
+ || MSYMBOL_TYPE (msymbol) == mst_text_gnu_ifunc
+ || MSYMBOL_TYPE (msymbol) == mst_file_text))
{
switch (MSYMBOL_TYPE (msymbol))
{
@@ -699,6 +700,16 @@ lookup_minimal_symbol_by_pc (CORE_ADDR p
{
return lookup_minimal_symbol_by_pc_section (pc, NULL);
}
+
+/* Return non-zero iff PC is in function implementing gnu-ifunc selection. */
+
+int
+in_gnu_ifunc_stub (CORE_ADDR pc)
+{
+ struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (pc);
+
+ return msymbol && MSYMBOL_TYPE (msymbol) == mst_text_gnu_ifunc;
+}
/* Return leading symbol character for a BFD. If BFD is NULL,
@@ -738,6 +749,7 @@ prim_record_minimal_symbol (const char *
switch (ms_type)
{
case mst_text:
+ case mst_text_gnu_ifunc:
case mst_file_text:
case mst_solib_trampoline:
section = SECT_OFF_TEXT (objfile);
@@ -1184,7 +1196,8 @@ find_solib_trampoline_target (struct fra
{
ALL_MSYMBOLS (objfile, msymbol)
{
- if (MSYMBOL_TYPE (msymbol) == mst_text
+ if ((MSYMBOL_TYPE (msymbol) == mst_text
+ || MSYMBOL_TYPE (msymbol) == mst_text_gnu_ifunc)
&& strcmp (SYMBOL_LINKAGE_NAME (msymbol),
SYMBOL_LINKAGE_NAME (tsymbol)) == 0)
return SYMBOL_VALUE_ADDRESS (msymbol);
Index: gdb-7.0.1/gdb/mips-linux-tdep.c
===================================================================
--- gdb-7.0.1.orig/gdb/mips-linux-tdep.c 2009-07-02 19:25:55.000000000 +0200
+++ gdb-7.0.1/gdb/mips-linux-tdep.c 2010-01-21 20:45:32.000000000 +0100
@@ -38,6 +38,7 @@
#include "target-descriptions.h"
#include "mips-linux-tdep.h"
#include "glibc-tdep.h"
+#include "linux-tdep.h"
static struct target_so_ops mips_svr4_so_ops;
@@ -1225,6 +1226,9 @@ mips_linux_init_abi (struct gdbarch_info
tdesc_numbered_register (feature, tdesc_data, MIPS_RESTART_REGNUM,
"restart");
}
+
+ set_gdbarch_convert_from_func_ptr_addr (gdbarch,
+ linux_convert_from_func_ptr_addr);
}
/* Provide a prototype to silence -Wmissing-prototypes. */
Index: gdb-7.0.1/gdb/mn10300-linux-tdep.c
===================================================================
--- gdb-7.0.1.orig/gdb/mn10300-linux-tdep.c 2009-02-22 02:02:19.000000000 +0100
+++ gdb-7.0.1/gdb/mn10300-linux-tdep.c 2010-01-21 20:45:32.000000000 +0100
@@ -32,6 +32,7 @@
#include "frame.h"
#include "trad-frame.h"
#include "tramp-frame.h"
+#include "linux-tdep.h"
#include <stdlib.h>
@@ -718,6 +719,9 @@ am33_linux_init_osabi (struct gdbarch_in
tramp_frame_prepend_unwinder (gdbarch, &am33_linux_sigframe);
tramp_frame_prepend_unwinder (gdbarch, &am33_linux_rt_sigframe);
+
+ set_gdbarch_convert_from_func_ptr_addr (gdbarch,
+ linux_convert_from_func_ptr_addr);
}
/* Provide a prototype to silence -Wmissing-prototypes. */
Index: gdb-7.0.1/gdb/parse.c
===================================================================
--- gdb-7.0.1.orig/gdb/parse.c 2010-01-21 20:45:22.000000000 +0100
+++ gdb-7.0.1/gdb/parse.c 2010-01-21 20:45:32.000000000 +0100
@@ -517,6 +517,11 @@ write_exp_msymbol (struct minimal_symbol
write_exp_elt_type (objfile_type (objfile)->nodebug_text_symbol);
break;
+ case mst_text_gnu_ifunc:
+ write_exp_elt_type (objfile_type (objfile)
+ ->nodebug_text_gnu_ifunc_symbol);
+ break;
+
case mst_data:
case mst_file_data:
case mst_bss:
Index: gdb-7.0.1/gdb/ppc-linux-tdep.c
===================================================================
--- gdb-7.0.1.orig/gdb/ppc-linux-tdep.c 2009-09-15 05:30:06.000000000 +0200
+++ gdb-7.0.1/gdb/ppc-linux-tdep.c 2010-01-21 20:45:32.000000000 +0100
@@ -48,6 +48,7 @@
#include "arch-utils.h"
#include "spu-tdep.h"
#include "xml-syscall.h"
+#include "linux-tdep.h"
#include "features/rs6000/powerpc-32l.c"
#include "features/rs6000/powerpc-altivec32l.c"
@@ -672,8 +673,19 @@ ppc64_linux_convert_from_func_ptr_addr (
res = bfd_get_section_contents (s->bfd, s->the_bfd_section,
&buf, addr - s->addr, 8);
if (res != 0)
- return extract_unsigned_integer (buf, 8, byte_order)
- - bfd_section_vma (s->bfd, s->the_bfd_section) + s->addr;
+ {
+ CORE_ADDR pc, resolved;
+
+ pc = extract_unsigned_integer (buf, 8, byte_order)
+ - bfd_section_vma (s->bfd, s->the_bfd_section) + s->addr;
+
+ resolved = linux_convert_from_func_and_ptr (gdbarch, addr, pc);
+ if (resolved != pc)
+ pc = ppc64_linux_convert_from_func_ptr_addr (gdbarch, resolved,
+ targ);
+
+ return pc;
+ }
}
return addr;
Index: gdb-7.0.1/gdb/solib-svr4.c
===================================================================
--- gdb-7.0.1.orig/gdb/solib-svr4.c 2010-01-21 20:45:23.000000000 +0100
+++ gdb-7.0.1/gdb/solib-svr4.c 2010-01-21 20:46:04.000000000 +0100
@@ -1250,7 +1250,8 @@ svr4_in_dynsym_resolve_code (CORE_ADDR p
{
return ((pc >= interp_text_sect_low && pc < interp_text_sect_high)
|| (pc >= interp_plt_sect_low && pc < interp_plt_sect_high)
- || in_plt_section (pc, NULL));
+ || in_plt_section (pc, NULL)
+ || in_gnu_ifunc_stub (pc));
}
/* Given an executable's ABFD and target, compute the entry-point
Index: gdb-7.0.1/gdb/sparc-linux-tdep.c
===================================================================
--- gdb-7.0.1.orig/gdb/sparc-linux-tdep.c 2009-07-02 19:25:58.000000000 +0200
+++ gdb-7.0.1/gdb/sparc-linux-tdep.c 2010-01-21 20:45:32.000000000 +0100
@@ -32,6 +32,7 @@
#include "symtab.h"
#include "trad-frame.h"
#include "tramp-frame.h"
+#include "linux-tdep.h"
#include "sparc-tdep.h"
@@ -279,6 +280,9 @@ sparc32_linux_init_abi (struct gdbarch_i
dwarf2_append_unwinders (gdbarch);
set_gdbarch_write_pc (gdbarch, sparc_linux_write_pc);
+
+ set_gdbarch_convert_from_func_ptr_addr (gdbarch,
+ linux_convert_from_func_ptr_addr);
}
/* Provide a prototype to silence -Wmissing-prototypes. */
Index: gdb-7.0.1/gdb/sparc64-linux-tdep.c
===================================================================
--- gdb-7.0.1.orig/gdb/sparc64-linux-tdep.c 2009-07-02 19:25:58.000000000 +0200
+++ gdb-7.0.1/gdb/sparc64-linux-tdep.c 2010-01-21 20:45:32.000000000 +0100
@@ -31,6 +31,7 @@
#include "symtab.h"
#include "trad-frame.h"
#include "tramp-frame.h"
+#include "linux-tdep.h"
#include "sparc64-tdep.h"
@@ -244,6 +245,9 @@ sparc64_linux_init_abi (struct gdbarch_i
tdep->step_trap = sparc64_linux_step_trap;
set_gdbarch_write_pc (gdbarch, sparc64_linux_write_pc);
+
+ set_gdbarch_convert_from_func_ptr_addr (gdbarch,
+ linux_convert_from_func_ptr_addr);
}
Index: gdb-7.0.1/gdb/symmisc.c
===================================================================
--- gdb-7.0.1.orig/gdb/symmisc.c 2010-01-21 20:45:22.000000000 +0100
+++ gdb-7.0.1/gdb/symmisc.c 2010-01-21 20:45:32.000000000 +0100
@@ -287,6 +287,9 @@ dump_msymbols (struct objfile *objfile,
case mst_text:
ms_type = 'T';
break;
+ case mst_text_gnu_ifunc:
+ ms_type = 'i';
+ break;
case mst_solib_trampoline:
ms_type = 'S';
break;
Index: gdb-7.0.1/gdb/symtab.c
===================================================================
--- gdb-7.0.1.orig/gdb/symtab.c 2010-01-21 20:45:22.000000000 +0100
+++ gdb-7.0.1/gdb/symtab.c 2010-01-21 20:45:32.000000000 +0100
@@ -3160,7 +3160,7 @@ search_symbols (char *regexp, domain_enu
{mst_file_data, mst_solib_trampoline, mst_abs, mst_unknown};
static enum minimal_symbol_type types4[]
=
- {mst_file_bss, mst_text, mst_abs, mst_unknown};
+ {mst_file_bss, mst_text_gnu_ifunc, mst_abs, mst_unknown};
enum minimal_symbol_type ourtype;
enum minimal_symbol_type ourtype2;
enum minimal_symbol_type ourtype3;
Index: gdb-7.0.1/gdb/symtab.h
===================================================================
--- gdb-7.0.1.orig/gdb/symtab.h 2010-01-21 20:45:21.000000000 +0100
+++ gdb-7.0.1/gdb/symtab.h 2010-01-21 20:45:32.000000000 +0100
@@ -275,6 +275,8 @@ enum minimal_symbol_type
{
mst_unknown = 0, /* Unknown type, the default */
mst_text, /* Generally executable instructions */
+ mst_text_gnu_ifunc, /* Executable code returning address
+ of executable code */
mst_data, /* Generally initialized data */
mst_bss, /* Generally uninitialized data */
mst_abs, /* Generally absolute (nonrelocatable) */
@@ -1149,6 +1151,8 @@ extern struct minimal_symbol *lookup_min
extern struct minimal_symbol *lookup_minimal_symbol_by_pc (CORE_ADDR);
+extern int in_gnu_ifunc_stub (CORE_ADDR pc);
+
extern struct minimal_symbol
*lookup_minimal_symbol_by_pc_section (CORE_ADDR, struct obj_section *);
Index: gdb-7.0.1/gdb/testsuite/gdb.base/gnu-ifunc-lib.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.0.1/gdb/testsuite/gdb.base/gnu-ifunc-lib.c 2010-01-21 20:45:32.000000000 +0100
@@ -0,0 +1,54 @@
+/* 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 <assert.h>
+
+typedef int (*final_t) (int arg);
+
+static int
+init_stub (int arg)
+{
+ return 0;
+}
+
+static int
+final (int arg)
+{
+ return arg + 1;
+}
+
+static volatile int gnu_ifunc_initialized;
+
+void
+gnu_ifunc_pre (void)
+{
+ assert (!gnu_ifunc_initialized);
+
+ gnu_ifunc_initialized = 1;
+}
+
+final_t gnu_ifuncX (void) asm ("gnu_ifunc");
+asm (".type gnu_ifunc, @gnu_indirect_function");
+
+final_t
+gnu_ifuncX (void)
+{
+ if (!gnu_ifunc_initialized)
+ return init_stub;
+ else
+ return final;
+}
Index: gdb-7.0.1/gdb/testsuite/gdb.base/gnu-ifunc.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.0.1/gdb/testsuite/gdb.base/gnu-ifunc.c 2010-01-21 20:45:32.000000000 +0100
@@ -0,0 +1,36 @@
+/* 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 <assert.h>
+
+extern int gnu_ifunc (int arg);
+extern void gnu_ifunc_pre (void);
+
+int
+main (void)
+{
+ int i;
+
+ gnu_ifunc_pre ();
+
+ i = gnu_ifunc (1); /* break-at-call */
+ assert (i == 2);
+
+ gnu_ifunc (2); /* break-at-nextcall */
+
+ return 0; /* break-at-exit */
+}
Index: gdb-7.0.1/gdb/testsuite/gdb.base/gnu-ifunc.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.0.1/gdb/testsuite/gdb.base/gnu-ifunc.exp 2010-01-21 20:45:32.000000000 +0100
@@ -0,0 +1,115 @@
+# Copyright (C) 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/>.
+
+if {[skip_shlib_tests]} {
+ return 0
+}
+
+set testfile "gnu-ifunc"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+
+set libfile "${testfile}-lib"
+set libsrc ${libfile}.c
+set lib_so ${objdir}/${subdir}/${libfile}.so
+
+set lib_nodebug_so_base ${libfile}-nodebug.so
+set lib_nodebug_so ${objdir}/${subdir}/${lib_nodebug_so_base}
+
+# {debug} provides DWARF symbol gnu_ifuncX confusing the ELF symbol
+# gnu_ifunc during address->symbol resolution for printing the symbol.
+# Still we need it here for "step"ping into the function.
+set lib_opts [list debug]
+set lib_nodebug_opts [list]
+set exec_opts [list debug shlib=$lib_so]
+
+if [get_compiler_info ${binfile}] {
+ return -1
+}
+
+if { [gdb_compile_shlib ${srcdir}/${subdir}/$libsrc $lib_so $lib_opts] != ""
+ || [gdb_compile ${srcdir}/${subdir}/$srcfile $binfile executable $exec_opts] != ""} {
+ untested "Could not compile either $libsrc or $srcfile."
+ return -1
+}
+
+# Start with a fresh gdb.
+
+clean_restart $testfile
+gdb_load_shlibs ${lib_so}
+
+if ![runto_main] then {
+ fail "Can't run to main"
+ return 1;
+}
+
+# The "if" condition is artifical to test regression of a format patch.
+gdb_breakpoint "[gdb_get_line_number "break-at-nextcall"] if i && gnu_ifunc (i) != 42"
+
+gdb_breakpoint [gdb_get_line_number "break-at-call"]
+gdb_continue_to_breakpoint "break-at-call" ".*break-at-call.*"
+
+# Test GDB will automatically indirect the call.
+
+gdb_test "p gnu_ifunc (3)" " = 4"
+
+# Test GDB will skip the gnu_ifunc resolver on first call.
+
+gdb_test "step" "\r\nfinal .*"
+
+# Test GDB will not break before the final chosen implementation.
+
+# Also test a format patch regression:
+# Continuing.
+# Error in testing breakpoint condition:
+# Attempt to take address of value not located in memory.
+#
+# Breakpoint 2, main () at ./gdb.base/gnu-ifunc.c:33
+
+gdb_test "continue" "Continuing.\r\n\r\nBreakpoint .* (at|in) .*break-at-nextcall.*" \
+ "continue to break-at-nextcall"
+
+gdb_breakpoint "gnu_ifunc"
+
+gdb_continue_to_breakpoint "nextcall gnu_ifunc"
+
+gdb_test "frame" "#0 +(0x\[0-9a-f\]+ in +)?final \\(.*" "nextcall gnu_ifunc skipped"
+
+
+# Compare the two different addresses:
+
+gdb_test "p gnu_ifunc" " = {<text variable, no debug info>} 0x\[0-9a-f\]+ <final>" "p gnu_ifunc executing"
+gdb_test "info sym gnu_ifunc" "final in section .*" "info sym gnu_ifunc executing"
+
+set test "info addr gnu_ifunc"
+gdb_test_multiple $test $test {
+ -re "Symbol \"gnu_ifunc\" is at (0x\[0-9a-f\]+) in .*$gdb_prompt $" {
+ pass $test
+ }
+}
+gdb_test "info sym $expect_out(1,string)" "gnu_ifunc in section .*" "info sym <gnu_ifunc-address>"
+
+# <*gnu_ifunc> would be an incorrect resolution from DW_AT_MIPS_linkage_name.
+# We do not use {debug} build option for this purpose.
+
+if { [gdb_compile_shlib ${srcdir}/${subdir}/$libsrc $lib_nodebug_so $lib_nodebug_opts] != ""} {
+ untested "Could not compile either $libsrc."
+ return -1
+}
+
+clean_restart $lib_nodebug_so_base
+
+gdb_test "p gnu_ifunc" " = {<text gnu-ifunc variable, no debug info>} 0x\[0-9a-f\]+ <gnu_ifunc>" "p gnu_ifunc not executing without debug"
+gdb_test "info sym gnu_ifunc" "gnu_ifunc in section .*" "info sym gnu_ifunc not executing without debug"
Index: gdb-7.0.1/gdb/xtensa-linux-tdep.c
===================================================================
--- gdb-7.0.1.orig/gdb/xtensa-linux-tdep.c 2009-02-22 02:02:20.000000000 +0100
+++ gdb-7.0.1/gdb/xtensa-linux-tdep.c 2010-01-21 20:45:32.000000000 +0100
@@ -22,6 +22,7 @@
#include "solib-svr4.h"
#include "symtab.h"
+#include "linux-tdep.h"
/* OS specific initialization of gdbarch. */
@@ -30,6 +31,9 @@ xtensa_linux_init_abi (struct gdbarch_in
{
set_solib_svr4_fetch_link_map_offsets
(gdbarch, svr4_ilp32_fetch_link_map_offsets);
+
+ set_gdbarch_convert_from_func_ptr_addr (gdbarch,
+ linux_convert_from_func_ptr_addr);
}
/* Provide a prototype to silence -Wmissing-prototypes. */
--- gdb-7.0.1/gdb/configure.tgt-orig 2009-08-06 12:28:38.000000000 +0200
+++ gdb-7.0.1/gdb/configure.tgt 2010-01-21 21:28:38.000000000 +0100
@@ -374,7 +374,7 @@ powerpc-*-aix* | rs6000-*-*)
;;
powerpc-*-linux* | powerpc64-*-linux*)
# Target: PowerPC running Linux
- gdb_target_obs="rs6000-tdep.o ppc-linux-tdep.o ppc-sysv-tdep.o \
+ gdb_target_obs="rs6000-tdep.o ppc-linux-tdep.o linux-tdep.o ppc-sysv-tdep.o \
solib.o solib-svr4.o solib-spu.o spu-multiarch.o \
corelow.o symfile-mem.o"
gdb_sim=../sim/ppc/libsim.a

View File

@ -0,0 +1,194 @@
[ Rediffed against gdb-7.0.1. ]
watchpoint-hw-hit-once.c is a part of:
http://sourceware.org/ml/gdb-patches/2009-11/msg00444.html
http://sourceware.org/ml/gdb-cvs/2009-11/msg00178.html
ec27fce19a16df73e763281ce3a6d0cdb718174e
--- a/gdb/config/i386/linux64.mh
+++ b/gdb/config/i386/linux64.mh
@@ -2,7 +2,7 @@
NATDEPFILES= inf-ptrace.o fork-child.o \
i386-nat.o amd64-nat.o amd64-linux-nat.o linux-nat.o \
proc-service.o linux-thread-db.o gcore.o linux-fork.o
-NAT_FILE= config/nm-linux.h
+NAT_FILE= nm-linux64.h
# The dynamically loaded libthread_db needs access to symbols in the
# gdb executable.
--- a/gdb/config/i386/nm-linux.h
+++ b/gdb/config/i386/nm-linux.h
@@ -29,4 +29,7 @@
#define FILL_FPXREGSET
#endif
+/* Red Hat backward compatibility with gdb-6.8. */
+#define target_can_use_hardware_watchpoint(type, cnt, ot) 1
+
#endif /* nm-linux.h */
--- /dev/null
+++ b/gdb/config/i386/nm-linux64.h
@@ -0,0 +1,28 @@
+/* Native support for GNU/Linux amd64.
+
+ Copyright 2010 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/>. */
+
+#ifndef NM_LINUX64_H
+#define NM_LINUX64_H
+
+#include "config/nm-linux.h"
+
+/* Red Hat backward compatibility with gdb-6.8. */
+#define target_can_use_hardware_watchpoint(type, cnt, ot) 1
+
+#endif /* NM_LINUX64_H */
--- gdb-7.0.1-orig/gdb/config/ia64/linux.mh 2007-04-26 00:17:48.000000000 +0200
+++ gdb-7.0.1/gdb/config/ia64/linux.mh 2010-02-24 01:40:21.000000000 +0100
@@ -1,6 +1,6 @@
# Host: Intel IA-64 running GNU/Linux
-NAT_FILE= config/nm-linux.h
+NAT_FILE= nm-linux.h
NATDEPFILES= inf-ptrace.o fork-child.o corelow.o gcore.o \
core-regset.o ia64-linux-nat.o \
proc-service.o linux-thread-db.o linux-nat.o linux-fork.o
--- /dev/null
+++ b/gdb/config/ia64/nm-linux.h
@@ -0,0 +1,28 @@
+/* Native support for GNU/Linux ia64.
+
+ Copyright 2010 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/>. */
+
+#ifndef NM_LINUX_H
+#define NM_LINUX_H
+
+#include "config/nm-linux.h"
+
+/* Red Hat backward compatibility with gdb-6.8. */
+#define target_can_use_hardware_watchpoint(type, cnt, ot) 1
+
+#endif /* NM_LINUX_H */
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -1257,8 +1257,10 @@ extern char *normal_pid_to_str (ptid_t ptid);
bp_hardware_breakpoint. CNT is the number of such watchpoints used so far
(including this one?). OTHERTYPE is who knows what... */
+#ifndef target_can_use_hardware_watchpoint
#define target_can_use_hardware_watchpoint(TYPE,CNT,OTHERTYPE) \
(*current_target.to_can_use_hw_breakpoint) (TYPE, CNT, OTHERTYPE);
+#endif
#define target_region_ok_for_hw_watchpoint(addr, len) \
(*current_target.to_region_ok_for_hw_watchpoint) (addr, len)
--- /dev/null
+++ b/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp
@@ -0,0 +1,40 @@
+# Copyright 2009, 2010 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/>.
+
+# Arch not supporting hw watchpoints does not imply no_hardware_watchpoints set.
+if {(![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"]
+ && ![istarget "ia64-*-*"])
+ || [target_info exists gdb,no_hardware_watchpoints]} then {
+ verbose "Skipping watchpoint-hw-before-run test."
+ return
+}
+
+set test watchpoint-hw-before-run
+set srcfile watchpoint-hw-hit-once.c
+if { [prepare_for_testing ${test}.exp ${test} ${srcfile}] } {
+ return -1
+}
+
+gdb_test "rwatch watchee" "ardware read watchpoint 1: watchee"
+
+# `runto_main' or `runto main' would delete the watchpoint created above.
+
+if { [gdb_start_cmd] < 0 } {
+ untested start
+ return -1
+}
+gdb_test "" "main .* at .*" "start"
+
+gdb_test "continue" "Continuing.\r\nHardware read watchpoint \[0-9\]+: watchee\r\n\r\nValue = 0\r\n.*"
--- /dev/null
+++ b/gdb/testsuite/gdb.base/watchpoint-hw-hit-once.c
@@ -0,0 +1,34 @@
+/* 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/>. */
+
+static int watchee;
+
+int
+main (void)
+{
+ volatile int dummy;
+
+ /* Stub lines are present as no breakpoints/watchpoint gets hit if current PC
+ already stays on the line PC while entering "step"/"continue". */
+
+ dummy = 0; /* Stub to catch WATCHEE access after runto_main. */
+ dummy = watchee;
+ dummy = 1; /* Stub to catch break-at-exit after WATCHEE has been hit. */
+ dummy = 2; /* break-at-exit */
+
+ return 0;
+}

View File

@ -0,0 +1,51 @@
FYI: DW_FORM_ref_addr -vs- DWARF 3
http://sourceware.org/ml/gdb-patches/2010-03/msg00219.html
http://sourceware.org/ml/gdb-cvs/2010-03/msg00039.html
### src/gdb/ChangeLog 2010/03/04 19:00:18 1.11430
### src/gdb/ChangeLog 2010/03/04 22:01:09 1.11431
## -1,3 +1,9 @@
+2010-03-04 Tom Tromey <tromey@redhat.com>
+
+ * dwarf2read.c (skip_one_die) <DW_FORM_ref_addr>: Use offset size
+ in DWARF 3 and later.
+ (read_attribute_value) <DW_FORM_ref_addr>: Likewise.
+
2010-03-04 Keith Seitz <keiths@redhat.com>
* linespec.c (decode_line_1): Update comments for is_quote_enclosed.
--- src/gdb/dwarf2read.c 2010/03/02 17:19:58 1.357
+++ src/gdb/dwarf2read.c 2010/03/04 22:01:10 1.358
@@ -2882,8 +2882,15 @@
skip_attribute:
switch (form)
{
- case DW_FORM_addr:
case DW_FORM_ref_addr:
+ /* In DWARF 2, DW_FORM_ref_addr is address sized; in DWARF 3
+ and later it is offset sized. */
+ if (cu->header.version == 2)
+ info_ptr += cu->header.addr_size;
+ else
+ info_ptr += cu->header.offset_size;
+ break;
+ case DW_FORM_addr:
info_ptr += cu->header.addr_size;
break;
case DW_FORM_data1:
@@ -7017,8 +7024,14 @@
attr->form = form;
switch (form)
{
- case DW_FORM_addr:
case DW_FORM_ref_addr:
+ if (cu->header.version == 2)
+ DW_ADDR (attr) = read_address (abfd, info_ptr, cu, &bytes_read);
+ else
+ DW_ADDR (attr) = read_offset (abfd, info_ptr, &cu->header, &bytes_read);
+ info_ptr += bytes_read;
+ break;
+ case DW_FORM_addr:
DW_ADDR (attr) = read_address (abfd, info_ptr, cu, &bytes_read);
info_ptr += bytes_read;
break;

View File

@ -0,0 +1,108 @@
http://sourceware.org/ml/archer/2010-q1/msg00047.html
Subject: [fortran-module] [commit] Fix a regression on setting breakpoint at
[ Backport for F-12. ]
f5c7672a52316155bc3367cbc2f0e7db22523634
https://bugzilla.redhat.com/show_bug.cgi?id=559291
gdb/
2010-02-03 Jan Kratochvil <jan.kratochvil@redhat.com>
David Moore <david.moore@intel.com>
* f-lang.c (f_lookup_symbol_nonlocal): Always fallback on
basic_lookup_symbol_nonlocal.
gdb/testsuite/
2010-02-03 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.fortran/module.exp (show language, setting breakpoint at module):
New.
* gdb.fortran/module.f90: New statement program module.
--- ./gdb/f-lang.c 2010-02-03 01:50:07.000000000 +0100
+++ ./gdb/f-lang.c 2010-02-03 01:49:06.000000000 +0100
@@ -308,33 +308,33 @@ f_lookup_symbol_nonlocal (const char *na
const struct block *block,
const domain_enum domain)
{
- struct fortran_using *use;
-
- if (!block)
- return NULL;
-
- for (use = BLOCK_FORTRAN_USE (block); use; use = use->next)
+ if (block)
{
- struct symbol *sym;
- struct type *type;
- struct symbol *retval;
-
- sym = lookup_symbol_global (use->module_name, block, MODULE_DOMAIN);
-
- /* Module name lookup should not fail with correct debug info. */
- if (sym == NULL)
- continue;
-
- type = SYMBOL_TYPE (sym);
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_MODULE);
- gdb_assert (TYPE_MODULE_BLOCK (type) != NULL);
-
- retval = lookup_block_symbol (TYPE_MODULE_BLOCK (type), name, domain);
- if (retval)
- return retval;
+ struct fortran_using *use;
+
+ for (use = BLOCK_FORTRAN_USE (block); use; use = use->next)
+ {
+ struct symbol *sym;
+ struct type *type;
+ struct symbol *retval;
+
+ sym = lookup_symbol_global (use->module_name, block, MODULE_DOMAIN);
+
+ /* Module name lookup should not fail with correct debug info. */
+ if (sym == NULL)
+ continue;
+
+ type = SYMBOL_TYPE (sym);
+ gdb_assert (TYPE_CODE (type) == TYPE_CODE_MODULE);
+ gdb_assert (TYPE_MODULE_BLOCK (type) != NULL);
+
+ retval = lookup_block_symbol (TYPE_MODULE_BLOCK (type), name, domain);
+ if (retval)
+ return retval;
+ }
}
- return NULL;
+ return basic_lookup_symbol_nonlocal (name, block, domain);
}
/* This is declared in c-lang.h but it is silly to import that file for what
--- ./gdb/testsuite/gdb.fortran/module.exp 2010-02-03 01:50:13.000000000 +0100
+++ ./gdb/testsuite/gdb.fortran/module.exp 2010-02-03 01:47:42.000000000 +0100
@@ -43,3 +43,13 @@ gdb_test "print var_b" " = 11"
gdb_test "print var_c" "No symbol \"var_c\" in current context\\."
gdb_test "print var_d" " = 12"
gdb_test "print var_i" " = 14" "print var_i value 14"
+
+# Breakpoint would work in language "c".
+gdb_test "show language" {The current source language is "(auto; currently )?fortran".}
+
+# gcc-4.4.2: The main program is always MAIN__ in .symtab so "runto" above
+# works. But DWARF DW_TAG_subprogram contains the name specified by
+# the "program" Fortran statement.
+if [gdb_breakpoint "module"] {
+ pass "setting breakpoint at module"
+}
--- ./gdb/testsuite/gdb.fortran/module.f90 2010-02-03 01:50:07.000000000 +0100
+++ ./gdb/testsuite/gdb.fortran/module.f90 2010-02-03 01:47:42.000000000 +0100
@@ -37,6 +37,8 @@ end module modmany
var_i = var_i ! i-is-2
end
+ program module
+
use modmany, only: var_b, var_d => var_c, var_i
call sub1

View File

@ -0,0 +1,174 @@
http://sourceware.org/ml/gdb-patches/2010-01/msg00661.html
Subject: [patch] Fix failed gdb_assert due to the PIE patchset
[ Backport for F-12/7.0. ]
Hi,
the PIE patchset brought in an occasionally failing gdb_assert (according to
Fedora ABRT bugreports).
solib-svr4.c:600: internal-error: scan_dyntag: Assertion `target_section < current_target_sections->sections_end' failed.
Now I understand it as generally current_target_sections are about target-side
data while symbols are the GDB side and there is only loose relation of those.
ABFD can be from multiple places acting for multiple purposes as parsed by
elf_lookup_lib_symbol:
exec_bfd:
It cannot be from exec_one - this BFD has no associated objfile to
pass to symfile_objfile. OK.
symfile_objfile:
It gets translated by elf_lookup_lib_symbol into exec_bfd which
represents the target data. OK.
so_list's objfile's separate_debug_objfile file:
gdb_assert-forbidden as input to elf_lookup_lib_symbol. OK.
so_list's objfile's main file:
update_solib_list must have called add_target_sections. OK.
objfile's separate_debug_objfile file:
gdb_assert-forbidden as input to elf_lookup_lib_symbol. OK.
objfile's main file (if it has no associated so_list):
Such ABFD from add_symbol_file_command has no add_target_sections
called. Still it can have current context BLOCK which crashes
scan_dyntag. BUG.
No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
The patch mostly reverts the PIE part there.
OK to check in?
Sorry,
Jan
gdb/
2010-01-31 Jan Kratochvil <jan.kratochvil@redhat.com>
* solib-svr4.c (scan_dyntag): New variable dyn_addr. Replace gdb_assert
by a conditional setting DYN_ADDR. Use DYN_ADDR.
* config/djgpp/fnchange.lst: Add translations for
symbol-without-target_section.exp and symbol-without-target_section.c.
gdb/testsuite/
2010-01-31 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/symbol-without-target_section.exp,
gdb.base/symbol-without-target_section.c: New.
--- a/gdb/config/djgpp/fnchange.lst
+++ b/gdb/config/djgpp/fnchange.lst
@@ -394,6 +394,8 @@
@V@/gdb/testsuite/gdb.base/solib-symbol-main.c @V@/gdb/testsuite/gdb.base/so-symmain.c
@V@/gdb/testsuite/gdb.base/solib-overlap-lib.c @V@/gdb/testsuite/gdb.base/so-ovrlib.c
@V@/gdb/testsuite/gdb.base/solib-overlap-main.c @V@/gdb/testsuite/gdb.base/so-ovrmain.c
+@V@/gdb/testsuite/gdb.base/gdb.base/symbol-without-target_section.exp @V@/gdb/testsuite/gdb.base/symnosec.exp
+@V@/gdb/testsuite/gdb.base/gdb.base/symbol-without-target_section.c @V@/gdb/testsuite/gdb.base/symnosec.c
@V@/gdb/testsuite/gdb.base/type-opaque-lib.c @V@/gdb/testsuite/gdb.base/ty-opqlib.c
@V@/gdb/testsuite/gdb.base/type-opaque-main.c @V@/gdb/testsuite/gdb.base/ty-opqmain.c
@V@/gdb/testsuite/gdb.base/watchpoint-hw.c @V@/gdb/testsuite/gdb.base/wp-hw.c
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -570,7 +570,7 @@ scan_dyntag (int dyntag, bfd *abfd, CORE_ADDR *ptr)
{
int arch_size, step, sect_size;
long dyn_tag;
- CORE_ADDR dyn_ptr;
+ CORE_ADDR dyn_ptr, dyn_addr;
gdb_byte *bufend, *bufstart, *buf;
Elf32_External_Dyn *x_dynp_32;
Elf64_External_Dyn *x_dynp_64;
@@ -627,7 +627,17 @@ scan_dyntag (int dyntag, bfd *abfd, CORE
target_section++)
if (sect == target_section->the_bfd_section)
break;
- gdb_assert (target_section < target_get_section_table (&exec_ops)->sections_end);
+ if (target_section < target_get_section_table (&exec_ops)->sections_end)
+ dyn_addr = target_section->addr;
+ else
+ {
+ /* ABFD may come from OBJFILE acting only as a symbol file without being
+ loaded into the target (see add_symbol_file_command). This case is
+ such fallback to the file VMA address without the possibility of
+ having the section relocated to its actual in-memory address. */
+
+ dyn_addr = bfd_section_vma (abfd, sect);
+ }
/* Read in .dynamic from the BFD. We will get the actual value
from memory later. */
@@ -639,7 +649,7 @@ scan_dyntag (int dyntag, bfd *abfd, CORE_ADDR *ptr)
CORE_ADDR ptr_addr;
ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
- ptr_addr = target_section->addr + (buf - bufstart) + arch_size / 8;
+ ptr_addr = dyn_addr + (buf - bufstart) + arch_size / 8;
if (target_read_memory (ptr_addr, ptr_buf, arch_size / 8) == 0)
dyn_ptr = extract_typed_address (ptr_buf, ptr_type);
*ptr = dyn_ptr;
--- /dev/null
+++ b/gdb/testsuite/gdb.base/symbol-without-target_section.c
@@ -0,0 +1,18 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2010 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/>. */
+
+int symbol_without_target_section;
--- /dev/null
+++ b/gdb/testsuite/gdb.base/symbol-without-target_section.exp
@@ -0,0 +1,39 @@
+# Copyright 2010 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/>.
+
+# Exploit formerly failed assertion in scan_dyntag when it got called for
+# objfile having ".dynamic" section but without having data loaded in target.
+# Such file is ${binmainfile} through add-symbol-file here. Set context first
+# by "list main" to have some local BLOCK set in lookup_symbol_global.
+
+set testfile symbol-without-target_section
+set srclibfile ${testfile}.c
+set binlibfile ${testfile}.x
+set srcmainfile start.c
+set binmainfile ${testfile}
+if { [gdb_compile "${srcdir}/${subdir}/${srclibfile}" \
+ "${objdir}/${subdir}/${binlibfile}" object {debug}] != "" } {
+ untested ${testfile}.exp
+ return -1
+}
+if {[build_executable ${testfile}.exp ${binmainfile} ${srcmainfile} {debug}] == -1} {
+ return -1
+}
+clean_restart ${binlibfile}
+
+gdb_test "add-symbol-file ${objdir}/${subdir}/${binmainfile} 0" "" "add-symbol-file" \
+ "add symbol table from file \".*\" at.*\\(y or n\\) " "y"
+gdb_test "list main"
+gdb_test "print symbol_without_target_section"

View File

@ -0,0 +1,30 @@
FYI: fix PR 11098
http://sourceware.org/ml/gdb-patches/2010-03/msg00117.html
http://sourceware.org/ml/gdb-cvs/2010-03/msg00020.html
### src/gdb/ChangeLog 2010/03/03 18:05:01 1.11418
### src/gdb/ChangeLog 2010/03/03 18:32:43 1.11419
## -1,3 +1,9 @@
+2010-03-03 Tom Tromey <tromey@redhat.com>
+
+ PR mi/11098:
+ * varobj.c (install_new_value): Handle case where new print_value
+ is NULL.
+
2010-03-03 Dainis Jonitis <jonitis@gmail.com>
PR gdb/11345:
--- src/gdb/varobj.c 2010/02/23 17:01:54 1.155
+++ src/gdb/varobj.c 2010/03/03 18:32:44 1.156
@@ -1593,7 +1593,10 @@
{
xfree (print_value);
print_value = value_get_print_value (var->value, var->format, var);
- if (!var->print_value || strcmp (var->print_value, print_value) != 0)
+ if ((var->print_value == NULL && print_value != NULL)
+ || (var->print_value != NULL && print_value == NULL)
+ || (var->print_value != NULL && print_value != NULL
+ && strcmp (var->print_value, print_value) != 0))
changed = 1;
}
if (var->print_value)

View File

@ -0,0 +1,73 @@
commit 770630ed9a3f11e8ec2d03557bf9852a1bbc507d
Author: Tom Tromey <tromey@redhat.com>
Date: Fri Feb 26 16:47:37 2010 -0700
Fix https://bugzilla.redhat.com/show_bug.cgi?id=561784
The bug is that psymtabs_addrmap can be left in an inconsistent
state when lazily reading psymtabs. This doesn't occur with
a non-lazy read because in that case the objfile is destroyed
on error.
This fix works by clearing out the psymtabs for an objfile
if reading fails.
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 18300c5..0c13fc7 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -2267,6 +2267,29 @@ build_type_psymtabs (struct objfile *objfile)
process_type_comp_unit, objfile);
}
+/* A cleanup function that clears an objfile's psymtabs. There are
+ two cases to consider. If we are reading symbols directly, then on
+ a failure the objfile will be destroyed. In this case, clearing
+ the psymtabs is fine -- a little wasted time, but nothing serious.
+ If we are reading symbols lazily, then it is too late to destroy
+ the objfile. Instead we just make it look like the objfile has no
+ psymtabs. */
+
+static void
+do_clear_psymtabs (void *arg)
+{
+ struct objfile *objfile = arg;
+
+ objfile->psymtabs_addrmap = NULL;
+ objfile->psymtabs = NULL;
+ bcache_xfree (objfile->psymbol_cache);
+ objfile->psymbol_cache = bcache_xmalloc ();
+ xfree (objfile->global_psymbols.list);
+ memset (&objfile->global_psymbols, 0, sizeof (objfile->global_psymbols));
+ xfree (objfile->static_psymbols.list);
+ memset (&objfile->static_psymbols, 0, sizeof (objfile->static_psymbols));
+}
+
/* Build the partial symbol table by doing a quick pass through the
.debug_info and .debug_abbrev sections. */
@@ -2277,7 +2300,7 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile)
mmap() on architectures that support it. (FIXME) */
bfd *abfd = objfile->obfd;
gdb_byte *info_ptr;
- struct cleanup *back_to;
+ struct cleanup *back_to, *clear_psymtabs;
info_ptr = dwarf2_per_objfile->info.buffer;
@@ -2291,6 +2314,7 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile)
objfile->psymtabs_addrmap =
addrmap_create_mutable (&objfile->objfile_obstack);
+ clear_psymtabs = make_cleanup (do_clear_psymtabs, objfile);
/* Since the objects we're extracting from .debug_info vary in
length, only the individual functions to extract them (like
@@ -2320,6 +2344,7 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile)
dwarf2_per_objfile->info.size);
}
+ discard_cleanups (clear_psymtabs);
objfile->psymtabs_addrmap = addrmap_create_fixed (objfile->psymtabs_addrmap,
&objfile->objfile_obstack);

View File

@ -0,0 +1,31 @@
Fix was a part of merge of master:
e421d7b026e77f4dc127de49c01e80d533eb6825
--- ./gdb/symfile.c 2010-02-28 23:22:31.000000000 +0100
+++ ./gdb/symfile.c 2010-02-28 23:29:00.000000000 +0100
@@ -3448,6 +3448,7 @@ reread_symbols (void)
objfile->symtabs = NULL;
objfile->psymtabs = NULL;
objfile->psymtabs_addrmap = NULL;
+ objfile->quick_addrmap = NULL;
objfile->free_psymtabs = NULL;
objfile->cp_namespace_symtab = NULL;
objfile->msymbols = NULL;
@@ -3458,6 +3459,8 @@ reread_symbols (void)
memset (&objfile->msymbol_demangled_hash, 0,
sizeof (objfile->msymbol_demangled_hash));
+ objfile->flags &= ~OBJF_SYMTABS_READ;
+
objfile->psymbol_cache = bcache_xmalloc ();
objfile->macro_cache = bcache_xmalloc ();
/* obstack_init also initializes the obstack so it is
@@ -3502,8 +3505,6 @@ reread_symbols (void)
wrap_here ("");
}
- objfile->flags &= ~OBJF_SYMTABS_READ;
-
/* We're done reading the symbol file; finish off complaints. */
clear_complaints (&symfile_complaints, 0, 1);

View File

@ -0,0 +1,159 @@
http://sourceware.org/ml/gdb-patches/2010-02/msg00625.html
Subject: RFC: fix bug with std::terminate handler
I would appreciate comments on this patch.
This comes from an automatically-reported bug in the Red Hat bugzilla:
https://bugzilla.redhat.com/show_bug.cgi?id=562975
call_function_by_hand installs a momentary breakpoint on std::terminate,
and then deletes it later. However, this can cause a double deletion of
the breakpoint. In the bug, the called function is dlopen, which causes
gdb to enter solib_add, which calls breakpoint_re_set, deleting the
momentary breakpoint.
This fix works by creating the momentary breakpoint with an internal
breakpoint number, and then trying to delete the breakpoint by number.
This bug does not always manifest in a crash. In fact, I couldn't make
it crash here, but I could observe the problem under valgrind.
Built and regtested on x86-64 (compile farm). I also manually verified
it using valgrind.
I think this patch is mildly ugly, due to the introduction of
set_momentary_breakpoint_at_pc_with_number. However, in the absence of
comments, I plan to check it in after a reasonable waiting period.
Tom
2010-02-25 Tom Tromey <tromey@redhat.com>
* infcall.c (do_delete_breakpoint_by_number): New function.
(call_function_by_hand): Refer to momentary breakpoint by number.
* breakpoint.h (set_momentary_breakpoint_at_pc_with_number):
Declare.
* breakpoint.c (set_momentary_breakpoint_at_pc_with_number): New
function.
Index: gdb-7.0.1/gdb/breakpoint.c
===================================================================
--- gdb-7.0.1.orig/gdb/breakpoint.c 2010-03-12 00:26:46.000000000 +0100
+++ gdb-7.0.1/gdb/breakpoint.c 2010-03-12 00:26:54.000000000 +0100
@@ -5647,6 +5647,20 @@ set_momentary_breakpoint_at_pc (struct g
return set_momentary_breakpoint (gdbarch, sal, null_frame_id, type);
}
+
+/* Like set_momentary_breakpoint_at_pc, but ensure that the new
+ breakpoint has a number. */
+
+struct breakpoint *
+set_momentary_breakpoint_at_pc_with_number (struct gdbarch *gdbarch,
+ CORE_ADDR pc,
+ enum bptype type)
+{
+ struct breakpoint *result = set_momentary_breakpoint_at_pc (gdbarch, pc,
+ type);
+ result->number = internal_breakpoint_number--;
+ return result;
+}
/* Tell the user we have just set a breakpoint B. */
Index: gdb-7.0.1/gdb/breakpoint.h
===================================================================
--- gdb-7.0.1.orig/gdb/breakpoint.h 2010-03-12 00:26:46.000000000 +0100
+++ gdb-7.0.1/gdb/breakpoint.h 2010-03-12 00:26:54.000000000 +0100
@@ -741,6 +741,9 @@ extern struct breakpoint *set_momentary_
extern struct breakpoint *set_momentary_breakpoint_at_pc
(struct gdbarch *, CORE_ADDR pc, enum bptype type);
+extern struct breakpoint *set_momentary_breakpoint_at_pc_with_number
+ (struct gdbarch *, CORE_ADDR pc, enum bptype type);
+
extern struct breakpoint *clone_momentary_breakpoint (struct breakpoint *bpkt);
extern void set_ignore_count (int, int, int);
Index: gdb-7.0.1/gdb/infcall.c
===================================================================
--- gdb-7.0.1.orig/gdb/infcall.c 2010-03-12 00:26:46.000000000 +0100
+++ gdb-7.0.1/gdb/infcall.c 2010-03-12 00:27:31.000000000 +0100
@@ -410,6 +410,18 @@ run_inferior_call (struct thread_info *c
return e;
}
+/* A cleanup function that deletes a breakpoint, if it still exists,
+ given the breakpoint's number. */
+
+static void
+do_delete_breakpoint_by_number (void *arg)
+{
+ int *num = arg;
+ struct breakpoint *bp = get_breakpoint (*num);
+ if (bp)
+ delete_breakpoint (bp);
+}
+
/* All this stuff with a dummy frame may seem unnecessarily complicated
(why not just save registers in GDB?). The purpose of pushing a dummy
frame which looks just like a real frame is so that if you call a
@@ -447,7 +459,8 @@ call_function_by_hand (struct value *fun
struct cleanup *args_cleanup;
struct frame_info *frame;
struct gdbarch *gdbarch;
- struct breakpoint *terminate_bp = NULL;
+ int terminate_bp_num = 0;
+ CORE_ADDR terminate_bp_addr = 0;
struct minimal_symbol *tm;
struct cleanup *terminate_bp_cleanup = NULL;
ptid_t call_thread_ptid;
@@ -764,8 +777,13 @@ call_function_by_hand (struct value *fun
struct minimal_symbol *tm = lookup_minimal_symbol ("std::terminate()",
NULL, NULL);
if (tm != NULL)
- terminate_bp = set_momentary_breakpoint_at_pc
+ {
+ struct breakpoint *bp;
+ bp = set_momentary_breakpoint_at_pc_with_number
(gdbarch, SYMBOL_VALUE_ADDRESS (tm), bp_breakpoint);
+ terminate_bp_num = bp->number;
+ terminate_bp_addr = bp->loc->address;
+ }
}
/* Everything's ready, push all the info needed to restore the
@@ -779,8 +797,9 @@ call_function_by_hand (struct value *fun
discard_cleanups (inf_status_cleanup);
/* Register a clean-up for unwind_on_terminating_exception_breakpoint. */
- if (terminate_bp)
- terminate_bp_cleanup = make_cleanup_delete_breakpoint (terminate_bp);
+ if (terminate_bp_num != 0)
+ terminate_bp_cleanup = make_cleanup (do_delete_breakpoint_by_number,
+ &terminate_bp_num);
/* - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP -
If you're looking to implement asynchronous dummy-frames, then
@@ -946,9 +965,9 @@ When the function is done executing, GDB
in an inferior function call. Rewind, and warn the
user. */
- if (terminate_bp != NULL
+ if (terminate_bp_num != 0
&& (inferior_thread()->stop_bpstat->breakpoint_at->address
- == terminate_bp->loc->address))
+ == terminate_bp_addr))
{
/* We must get back to the frame we were before the
dummy call. */
@@ -997,7 +1016,7 @@ When the function is done executing, GDB
/* If we get here and the std::terminate() breakpoint has been set,
it has to be cleaned manually. */
- if (terminate_bp)
+ if (terminate_bp_num != 0)
do_cleanups (terminate_bp_cleanup);
/* If we get here the called FUNCTION ran to completion,

View File

@ -0,0 +1,73 @@
http://sourceware.org/ml/gdb-patches/2010-04/msg00055.html
Subject: [patch] Fix dangling displays in separate debug
[ Backported. ]
Hi,
gdb.base/solib-display.exp using _separate_ debug info:
3: c_global = gdbtypes.c:1369: internal-error: check_typedef: Assertion `type' failed.
A problem internal to GDB has been detected,
This problem was fixed before by:
[patch 1/8] Types GC [unloading observer]
http://sourceware.org/ml/gdb-patches/2009-05/msg00544.html
Re: [patch 3/8] Types GC [display_uses_solib_p to exp_iterate]
http://sourceware.org/ml/gdb-patches/2009-07/msg00054.html
but as that patchset is still not in providing this temporary fixup instead.
One may only address that gdb.base/solib-display.exp was testing symbol
in-objfile while now it tests only symbol in-sepdebug-objfile and no longer
the in-objfile case. I find the in-sepdebug-objfile as a superset of
in-objfile test but I can rework it if anyones addresses this test change.
No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
Thanks,
Jan
gdb/
2010-04-03 Jan Kratochvil <jan.kratochvil@redhat.com>
* printcmd.c (display_uses_solib_p): Check also
SEPARATE_DEBUG_OBJFILE.
gdb/testsuite/
2010-04-03 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/solib-display.exp (split solib): New.
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1845,7 +1845,10 @@ clear_dangling_display_expressions (stru
for (d = display_chain; d != NULL; d = d->next)
if (block_objfile (d->block) == objfile
- || (d->exp && exp_uses_objfile (d->exp, objfile)))
+ || (d->exp && exp_uses_objfile (d->exp, objfile))
+ || (objfile->separate_debug_objfile
+ && (block_objfile (d->block) == objfile->separate_debug_objfile
+ || (d->exp && exp_uses_objfile (d->exp, objfile->separate_debug_objfile)))))
{
xfree (d->exp);
d->exp = NULL;
--- a/gdb/testsuite/gdb.base/solib-display.exp
+++ b/gdb/testsuite/gdb.base/solib-display.exp
@@ -53,6 +53,13 @@ if { [gdb_compile_shlib ${srcfile_lib} ${binfile_lib} $lib_flags] != ""
return -1
}
+set test "split solib"
+if {[gdb_gnu_strip_debug $binfile_lib] != 0} {
+ fail $test
+} else {
+ pass $test
+}
+
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir

View File

@ -0,0 +1,191 @@
http://sourceware.org/ml/gdb-patches/2010-03/msg00799.html
Subject: [patch] Fix separate-debug with non-unique section names (PR 11409)
A different version was checked-in but they are interchangeable:
http://sourceware.org/ml/gdb-patches/2010-03/msg00799.html
http://sourceware.org/ml/gdb-cvs/2010-03/msg00241.html
Hi,
gdb-7.1 is now broken for example for debugging /usr/bin/emacs due to:
http://sourceware.org/bugzilla/show_bug.cgi?id=11409
[22] .data PROGBITS 00000000007fe8a0 1fe8a0 215068 00 WA 0 0 32
[23] .data PROGBITS 0000000000a13920 413920 68c6e0 00 WA 0 0 32
It is in fact a regression against gdb-7.0 by me due to:
commit 71d0069a9f238a11f7f455bf6ad2adfc25683521
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Tue Jan 5 15:51:01 2010 +0000
gdb/
* symfile.c (syms_from_objfile): Remove the !MAINLINE conditional.
as while the code was broken even before the broken relocation was not applied
to mainline binary (before PIE+OSX patches went in).
No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
OK to check-in also for gdb-7.1 (7.1.1)?
Thanks,
Jan
gdb/
2010-03-23 Jan Kratochvil <jan.kratochvil@redhat.com>
* symfile.c (addr_info_make_relative): Move sect declaration to the
outer block. Initialize it to NULL. Prefer SECT->next more than
bfd_get_section_by_name.
gdb/testsuite/
2010-03-23 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/dup-sect.exp, gdb.base/dup-sect.S: New.
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -529,6 +529,7 @@ addr_info_make_relative (struct section_addr_info *addrs, bfd *abfd)
asection *lower_sect;
CORE_ADDR lower_offset;
int i;
+ asection *sect;
/* Find lowest loadable section to be used as starting point for
continguous sections. FIXME!! won't work without call to find
@@ -553,11 +554,23 @@ addr_info_make_relative (struct section_addr_info *addrs, bfd *abfd)
(the loadable section directly below it in memory).
this_offset = lower_offset = lower_addr - lower_orig_addr */
+ sect = NULL;
for (i = 0; i < addrs->num_sections && addrs->other[i].name; i++)
{
const char *sect_name = addrs->other[i].name;
- asection *sect = bfd_get_section_by_name (abfd, sect_name);
+ /* Prefer the next section of that we have found last. The separate
+ debug info files have either the same section layout or just a few
+ sections are missing there. On the other hand the section name is not
+ unique and we could find an inappropraite section by its name. */
+
+ if (sect)
+ sect = sect->next;
+ if (sect && strcmp (sect_name, bfd_get_section_name (abfd, sect)) != 0)
+ sect = NULL;
+
+ if (sect == NULL)
+ sect = bfd_get_section_by_name (abfd, sect_name);
if (sect)
{
/* This is the index used by BFD. */
--- /dev/null
+++ b/gdb/testsuite/gdb.base/dup-sect.S
@@ -0,0 +1,22 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2010 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/>. */
+
+ .section sect1, "a"
+var1: .byte 1
+
+ .section sect2, "a"
+var2: .byte 2
--- /dev/null
+++ b/gdb/testsuite/gdb.base/dup-sect.exp
@@ -0,0 +1,79 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2010 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/>.
+
+# Test inappropriate offseting of multiple sections with the same name.
+# When kept in object file (before final executable link) it still works.
+# When separate debug info file is not used it still works.
+# When the ELF symbol table is kept in the main binary it still works.
+# Used .S file as in .c file we would need __attriute__((section)) which is
+# a GCC extension.
+
+# This test can only be run on targets which support ELF and use gas.
+# For now pick a sampling of likely targets.
+if {![istarget *-*-linux*]
+ && ![istarget *-*-gnu*]
+ && ![istarget *-*-elf*]
+ && ![istarget arm-*-eabi*]
+ && ![istarget powerpc-*-eabi*]} {
+ return 0
+}
+
+set testfile dup-sect
+set srcfile ${testfile}.S
+set srcmainfile start.c
+set executable ${testfile}
+set binfile ${objdir}/${subdir}/${executable}
+
+if {[build_executable ${testfile}.exp $executable [list ${srcfile} ${srcmainfile}] {}] == -1} {
+ return -1
+}
+
+set test "rename section"
+set objcopy_program [transform objcopy]
+set result [catch "exec $objcopy_program --rename-section sect2=sect1 $binfile" output]
+verbose "result is $result"
+verbose "output is $output"
+if {$result != 0} {
+ fail $test
+ return
+}
+pass $test
+
+set test "split"
+if {[gdb_gnu_strip_debug $binfile] != 0} {
+ fail $test
+} else {
+ pass $test
+}
+
+# gdb_gnu_strip_debug uses only --strip-debug and keeps the ELF symbol table
+# in $binfile.
+set test "strip"
+set strip_program [transform strip]
+set result [catch "exec $strip_program $binfile" output]
+verbose "result is $result"
+verbose "output is $output"
+if {$result != 0} {
+ fail $test
+ return
+}
+pass $test
+
+clean_restart $executable
+
+gdb_test "p/d *(const char *) &var1" " = 1" "var1 after strip"
+gdb_test "p/d *(const char *) &var2" " = 2" "var2 after strip"

View File

@ -0,0 +1,51 @@
+++ ./libstdc++-v3-python-r155978/libstdcxx/v6/printers.py 2010/01/15 22:52:16 155950
--- ./libstdc++-v3-python-r155978/libstdcxx/v6/printers.py 2010/01/15 23:36:58 155951
@@ -1,6 +1,6 @@
# Pretty-printers for libstc++.
+# Copyright (C) 2008, 2009 Free Software Foundation, Inc.
-# Copyright (C) 2008, 2009, 2010 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
@@ -529,10 +529,18 @@
class StdStringPrinter:
"Print a std::basic_string of some kind"
+ def __init__(self, encoding, val):
+ self.encoding = encoding
- def __init__(self, val):
self.val = val
def to_string(self):
+ # Look up the target encoding as late as possible.
+ encoding = self.encoding
+ if encoding == 0:
+ encoding = gdb.parameter('target-charset')
+ elif encoding == 1:
+ encoding = gdb.parameter('target-wide-charset')
+
# Make sure &string works, too.
type = self.val.type
if type.code == gdb.TYPE_CODE_REF:
@@ -554,7 +546,7 @@
reptype = gdb.lookup_type (str (realtype) + '::_Rep').pointer ()
header = ptr.cast(reptype) - 1
len = header.dereference ()['_M_length']
+ return self.val['_M_dataplus']['_M_p'].string (encoding, length = len)
- return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
def display_hint (self):
return 'string'
@@ -687,7 +679,10 @@
# libstdc++ objects requiring pretty-printing.
# In order from:
# http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a01847.html
+ pretty_printers_dict[re.compile('^std::basic_string<char(,.*)?>$')] = lambda val: StdStringPrinter(0, val)
+ pretty_printers_dict[re.compile('^std::basic_string<wchar_t(,.*)?>$')] = lambda val: StdStringPrinter(1, val)
+ pretty_printers_dict[re.compile('^std::basic_string<char16_t(,.*)?>$')] = lambda val: StdStringPrinter('UTF-16', val)
+ pretty_printers_dict[re.compile('^std::basic_string<char32_t(,.*)?>$')] = lambda val: StdStringPrinter('UTF-32', val)
- pretty_printers_dict[re.compile('^std::basic_string<.*>$')] = lambda val: StdStringPrinter(val)
pretty_printers_dict[re.compile('^std::bitset<.*>$')] = lambda val: StdBitsetPrinter("std::bitset", val)
pretty_printers_dict[re.compile('^std::deque<.*>$')] = lambda val: StdDequePrinter("std::deque", val)
pretty_printers_dict[re.compile('^std::list<.*>$')] = lambda val: StdListPrinter("std::list", val)

View File

@ -0,0 +1,79 @@
https://bugzilla.redhat.com/show_bug.cgi?id=586566
http://sourceware.org/ml/gdb-patches/2010-03/msg00746.html
http://sourceware.org/ml/gdb-patches/2010-05/msg00551.html
http://sourceware.org/ml/gdb-cvs/2010-03/msg00194.html
### src/gdb/ChangeLog 2010/03/19 22:00:16 1.11508
### src/gdb/ChangeLog 2010/03/20 05:17:10 1.11509
## -1,3 +1,9 @@
+2010-03-20 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * tui/tui-disasm.c (tui_get_begin_asm_address): Default to
+ get_current_arch.
+ * tui/tui-layout.c (extract_display_start_addr): Likewise.
+
2010-03-19 Stan Shebs <stan@codesourcery.com>
* ax-gdb.c (gen_fetch): Handle bool.
--- src/gdb/tui/tui-disasm.c 2010/01/01 07:32:07 1.33
+++ src/gdb/tui/tui-disasm.c 2010/03/20 05:17:10 1.34
@@ -21,6 +21,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
+#include "arch-utils.h"
#include "symtab.h"
#include "breakpoint.h"
#include "frame.h"
@@ -330,7 +331,7 @@
{
struct tui_gen_win_info *locator;
struct tui_locator_element *element;
- struct gdbarch *gdbarch = NULL;
+ struct gdbarch *gdbarch = get_current_arch ();
CORE_ADDR addr;
locator = tui_locator_win_info_ptr ();
--- src/gdb/tui/tui-layout.c 2010/01/01 07:32:07 1.36
+++ src/gdb/tui/tui-layout.c 2010/03/20 05:17:10 1.37
@@ -21,6 +21,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
+#include "arch-utils.h"
#include "command.h"
#include "symtab.h"
#include "frame.h"
@@ -522,7 +523,7 @@
extract_display_start_addr (struct gdbarch **gdbarch_p, CORE_ADDR *addr_p)
{
enum tui_layout_type cur_layout = tui_current_layout ();
- struct gdbarch *gdbarch = NULL;
+ struct gdbarch *gdbarch = get_current_arch ();
CORE_ADDR addr;
CORE_ADDR pc;
struct symtab_and_line cursal = get_current_source_symtab_and_line ();
--- /dev/null 2010-05-24 04:43:32.632794021 +0200
+++ gdb-7.1/gdb/testsuite/gdb.base/tui-layout.exp 2010-05-24 20:13:30.000000000 +0200
@@ -0,0 +1,21 @@
+# Copyright 2010 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/>.
+
+set testfile tui-layout
+if { [prepare_for_testing ${testfile}.exp ${testfile} start.c] } {
+ return -1
+}
+
+gdb_test "layout asm"

View File

@ -0,0 +1,239 @@
http://sourceware.org/ml/archer/2010-q3/msg00028.html
Subject: [delayed-symfile] [commit] Fix a regression on CFI without DIE [Re:
On Wed, 25 Feb 2009 00:14:29 +0100, Jan Kratochvil wrote:
> commit 6a37c2b9962258ecf9299cc34a650e64a06acaa5
>
> There was a regression on gdb.base/savedregs.exp.
>
> quick_addrmap/require_partial_symbols should be used even for the unwind debug
> info checking as its load has been also delayed by this branch.
[...]
> --- a/gdb/dwarf2-frame.c
> +++ b/gdb/dwarf2-frame.c
[...]
> @@ -1499,6 +1500,14 @@ dwarf2_frame_find_fde (CORE_ADDR *pc)
> struct dwarf2_fde *fde;
> CORE_ADDR offset;
>
> + if (objfile->quick_addrmap)
> + {
> + if (!addrmap_find (objfile->quick_addrmap, *pc))
> + continue;
> + }
> + /* FIXME: Read-in only .debug_frame/.eh_frame without .debug_info? */
> + require_partial_symbols (objfile);
> +
but this has caused a different regression (as discussed in the confcall).
QUICK_ADDRMAP is built only from .debug_aranges. But we can have existing
built .debug_aranges for CUs in OBJFILE but still some CUs do not need to have
DWARF at all while they can feature CFIs (.eh_frame or .debug_frame).
It has been described by Daniel Jacobowitz at:
Re: [2/4] RFC: check psymtabs_addrmap before reading FDEs
http://sourceware.org/ml/gdb-patches/2010-07/msg00012.html
Sorry for this regression by me (in that fix of a different regression).
Fixed it the "slow way" as this branch is now obsoleted by .gdb-index.
No regressions on {x86_64,x86_64-m32,i686}-fedora13-linux-gnu.
Checked-in.
Thanks,
Jan
eb8df8566acc1ed963e3e9b77c13b9c2c3db03fb
Test CFI is parsed even for range (function) not described by any DIE.
https://bugzilla.redhat.com/show_bug.cgi?id=614028
gdb/
* dwarf2-frame.c (dwarf2_frame_find_fde): Remove the
OBJFILE->QUICK_ADDRMAP check. New comment why.
gdb/testsuite/
* gdb.base/cfi-without-die.exp, gdb.base/cfi-without-die-main.c,
gdb.base/cfi-without-die-caller.c: New files.
---
gdb/dwarf2-frame.c | 8 +--
gdb/testsuite/gdb.base/cfi-without-die-caller.c | 28 ++++++++++
gdb/testsuite/gdb.base/cfi-without-die-main.c | 32 +++++++++++
gdb/testsuite/gdb.base/cfi-without-die.exp | 67 +++++++++++++++++++++++
4 files changed, 130 insertions(+), 5 deletions(-)
create mode 100644 gdb/testsuite/gdb.base/cfi-without-die-caller.c
create mode 100644 gdb/testsuite/gdb.base/cfi-without-die-main.c
create mode 100644 gdb/testsuite/gdb.base/cfi-without-die.exp
diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c
index 5915249..1dc2754 100644
--- a/gdb/dwarf2-frame.c
+++ b/gdb/dwarf2-frame.c
@@ -1583,11 +1583,9 @@ dwarf2_frame_find_fde (CORE_ADDR *pc)
CORE_ADDR offset;
CORE_ADDR seek_pc;
- if (objfile->quick_addrmap)
- {
- if (!addrmap_find (objfile->quick_addrmap, *pc))
- continue;
- }
+ /* OBJFILE->QUICK_ADDRMAP contains offsets only for DIEs. It does not
+ contain ranges of CFIs. */
+
/* FIXME: Read-in only .debug_frame/.eh_frame without .debug_info? */
require_partial_symbols (objfile);
diff --git a/gdb/testsuite/gdb.base/cfi-without-die-caller.c b/gdb/testsuite/gdb.base/cfi-without-die-caller.c
new file mode 100644
index 0000000..afdfd53
--- /dev/null
+++ b/gdb/testsuite/gdb.base/cfi-without-die-caller.c
@@ -0,0 +1,28 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2005, 2007, 2008, 2009, 2010 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/>. */
+
+typedef int (*callback_t) (void);
+
+int
+caller (callback_t callback)
+{
+ /* Ensure some frame content to push away the return address. */
+ volatile const long one = 1;
+
+ /* Modify the return value to prevent any tail-call optimization. */
+ return (*callback) () - one;
+}
diff --git a/gdb/testsuite/gdb.base/cfi-without-die-main.c b/gdb/testsuite/gdb.base/cfi-without-die-main.c
new file mode 100644
index 0000000..8451c4b
--- /dev/null
+++ b/gdb/testsuite/gdb.base/cfi-without-die-main.c
@@ -0,0 +1,32 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2005, 2007, 2008, 2009, 2010 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/>. */
+
+typedef int (*callback_t) (void);
+
+extern int caller (callback_t callback);
+
+int
+callback (void)
+{
+ return 1;
+}
+
+int
+main (void)
+{
+ return caller (callback);
+}
diff --git a/gdb/testsuite/gdb.base/cfi-without-die.exp b/gdb/testsuite/gdb.base/cfi-without-die.exp
new file mode 100644
index 0000000..db6d248
--- /dev/null
+++ b/gdb/testsuite/gdb.base/cfi-without-die.exp
@@ -0,0 +1,67 @@
+# Copyright 2010 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/>.
+
+# Test CFI is parsed even for range (function) not described by any DIE.
+
+set testfile cfi-without-die
+set srcmainfile ${testfile}-main.c
+set srccallerfile ${testfile}-caller.c
+set executable ${testfile}
+set objmainfile ${objdir}/${subdir}/${testfile}-main.o
+set objcallerfile ${objdir}/${subdir}/${testfile}-caller.o
+set binfile ${objdir}/${subdir}/${executable}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srccallerfile}" ${objcallerfile} \
+ object [list {additional_flags=-fomit-frame-pointer -fno-unwind-tables -fno-asynchronous-unwind-tables}]] != ""
+ || [gdb_compile "${srcdir}/${subdir}/${srcmainfile}" ${objmainfile} object {debug}] != ""
+ || [gdb_compile "${objmainfile} ${objcallerfile}" ${binfile} executable {}] != "" } {
+ untested ${testfile}.exp
+ return -1
+}
+
+clean_restart $executable
+
+if ![runto callback] then {
+ fail "verify unwinding: Can't run to callback"
+ return 0
+}
+set test "verify unwinding breaks without CFI"
+gdb_test_multiple "bt" $test {
+ -re " in main .*\r\n$gdb_prompt $" {
+ fail $test
+ }
+ -re "\r\n$gdb_prompt $" {
+ pass $test
+ }
+}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srccallerfile}" ${objcallerfile} \
+ object [list {additional_flags=-fomit-frame-pointer -funwind-tables -fasynchronous-unwind-tables}]] != ""
+ || [gdb_compile "${srcdir}/${subdir}/${srcmainfile}" ${objmainfile} object {debug}] != ""
+ || [gdb_compile "${objmainfile} ${objcallerfile}" ${binfile} executable {}] != "" } {
+ untested ${testfile}.exp
+ return -1
+}
+
+clean_restart $executable
+
+if ![runto callback] then {
+ fail "test CFI without DIEs: Can't run to callback"
+ return 0
+}
+# #0 callback () at ...
+# #1 0x00000000004004e9 in caller ()
+# #2 0x00000000004004cd in main () at ...
+gdb_test "bt" "#0 +callback \[^\r\n\]+\r\n#1 \[^\r\n\]+ in caller \[^\r\n\]+\r\n#2 \[^\r\n\]+ in main \[^\r\n\]+" "verify unwindin works for CFI without DIEs"
--
1.7.1.1

View File

@ -0,0 +1,207 @@
http://sourceware.org/ml/gdb-patches/2010-07/msg00237.html
Subject: [patch] Fix regression on prelinked executables
Hi,
there is a regression since gdb-7.0 for a combination of:
* prelinked
* main executable
* using separate debug info
* using copy relocations
It is since a patch for both PIE and (AFAIK) OSX support:
[commit] syms_from_objfile: Relativize also MAINLINE
http://sourceware.org/ml/gdb-patches/2010-01/msg00080.html
which started to use problematic addr_info_make_relative even for main
executables. prelink<->gdb discussion at:
https://bugzilla.redhat.com/show_bug.cgi?id=614659
Currently in the unfortunately executables GDB has invalid displcement for
symbols in .bss:
int bssvar, *bssvarp = &bssvar;
(gdb) p &bssvar
$1 = (int *) 0x600b54
(gdb) p bssvarp
$2 = (int *) 0x600b50
<abstract-higher-point-of-view>
addr_info_make_relative could just simply subtract entry point address and
provide single CORE_ADDR objfile->offset (instead of the current
section_offsets array with offsets specific for each section). Linux systems
use always single offset for the whole objfile. AFAIK these per-section
offsets are there for some embedded targets. Curiously GDB already uses at
many places
baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
instead of using offset for the appropriate section at that place and nobody
complains.
</abstract-higher-point-of-view>
No regressions on {x86_64,x86_64-m32,i686}-fedora13-linux-gnu.
Proposing for the gdb-7.2 branch. I had problems fixing up my crashing X.
Thanks,
Jan
gdb/
2010-07-15 Jan Kratochvil <jan.kratochvil@redhat.com>
* symfile.c (addr_section_name): New function.
(addrs_section_compar): Use it.
(addr_info_make_relative): Use it. Move variable sect_name into a more
inner block. Make ".dynbss" and ".sdynbss" checks more strict.
gdb/testsuite/
2010-07-15 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/prelink-lib.c (copyreloc): New initialized variable.
* gdb.base/prelink.c (copyreloc, bssvar, bssvarp): New variables.
(main): Use copyreloc.
* gdb.base/prelink.exp (split debug of executable)
(.dynbss vs. .bss address shift): New tests.
Index: gdb-7.0.1/gdb/symfile.c
===================================================================
--- gdb-7.0.1.orig/gdb/symfile.c 2010-07-20 19:32:29.000000000 +0200
+++ gdb-7.0.1/gdb/symfile.c 2010-07-20 19:33:45.000000000 +0200
@@ -609,6 +609,23 @@ relative_addr_info_to_section_offsets (s
}
}
+/* Transform section name S for a name comparison. prelink can split section
+ `.bss' into two sections `.dynbss' and `.bss' (in this order). Similarly
+ prelink can split `.sbss' into `.sdynbss' and `.sbss'. Use virtual address
+ of the new `.dynbss' (`.sdynbss') section as the adjacent new `.bss'
+ (`.sbss') section has invalid (increased) virtual address. */
+
+static const char *
+addr_section_name (const char *s)
+{
+ if (strcmp (s, ".dynbss") == 0)
+ return ".bss";
+ if (strcmp (s, ".sdynbss") == 0)
+ return ".sbss";
+
+ return s;
+}
+
/* Relativize absolute addresses in ADDRS into offsets based on ABFD. Fill-in
also SECTINDEXes specific to ABFD there. This function can be used to
rebase ADDRS to start referencing different BFD than before. */
@@ -661,8 +678,17 @@ addr_info_make_relative (struct section_
if (sect && strcmp (sect_name, bfd_get_section_name (abfd, sect)) != 0)
sect = NULL;
- if (sect == NULL)
- sect = bfd_get_section_by_name (abfd, sect_name);
+ /* Prevent the search by name if `.bss' has the address already set from
+ `.dynbss'. */
+ if (sect == NULL
+ && !(0
+ || (strcmp (sect_name, ".bss") == 0
+ && i > 0
+ && strcmp (addrs->other[i - 1].name, ".dynbss") == 0)
+ || (strcmp (sect_name, ".sbss") == 0
+ && i > 0
+ && strcmp (addrs->other[i - 1].name, ".sdynbss") == 0)))
+ sect = bfd_get_section_by_name (abfd, addr_section_name (sect_name));
if (sect)
{
/* This is the index used by BFD. */
@@ -688,12 +714,18 @@ addr_info_make_relative (struct section_
a warning. Shared libraries contain just the section
".gnu.liblist" but it is not marked as loadable there. There is
no other way to identify them than by their name as the sections
- created by prelink have no special flags. */
+ created by prelink have no special flags.
+
+ For the sections `.bss' and `.sbss' see addr_section_name. */
if (!(strcmp (sect_name, ".gnu.liblist") == 0
|| strcmp (sect_name, ".gnu.conflict") == 0
- || strcmp (sect_name, ".dynbss") == 0
- || strcmp (sect_name, ".sdynbss") == 0))
+ || (strcmp (sect_name, ".bss") == 0
+ && i > 0
+ && strcmp (addrs->other[i - 1].name, ".dynbss") == 0)
+ || (strcmp (sect_name, ".sbss") == 0
+ && i > 0
+ && strcmp (addrs->other[i - 1].name, ".sdynbss") == 0)))
warning (_("section %s not found in %s"), sect_name,
bfd_get_filename (abfd));
Index: gdb-7.0.1/gdb/testsuite/gdb.base/prelink-lib.c
===================================================================
--- gdb-7.0.1.orig/gdb/testsuite/gdb.base/prelink-lib.c 2009-01-03 06:58:03.000000000 +0100
+++ gdb-7.0.1/gdb/testsuite/gdb.base/prelink-lib.c 2010-07-20 19:33:45.000000000 +0200
@@ -16,6 +16,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+int copyreloc = 1;
+
int
g (void (*p)(void))
{
Index: gdb-7.0.1/gdb/testsuite/gdb.base/prelink.c
===================================================================
--- gdb-7.0.1.orig/gdb/testsuite/gdb.base/prelink.c 2009-01-03 06:58:03.000000000 +0100
+++ gdb-7.0.1/gdb/testsuite/gdb.base/prelink.c 2010-07-20 19:33:45.000000000 +0200
@@ -18,6 +18,11 @@
#include <stdio.h>
+extern int copyreloc;
+
+/* Test GDB itself finds `&bssvar' right. */
+static int bssvar, *bssvarp = &bssvar;
+
extern void (*h (void)) (void (*)(void));
int
@@ -25,5 +30,6 @@ main (void)
{
void (*f) (void (*)(void)) = h ();
printf ("%p\n", f);
+ printf ("%d\n", copyreloc);
f (0);
}
Index: gdb-7.0.1/gdb/testsuite/gdb.base/prelink.exp
===================================================================
--- gdb-7.0.1.orig/gdb/testsuite/gdb.base/prelink.exp 2010-07-20 19:32:28.000000000 +0200
+++ gdb-7.0.1/gdb/testsuite/gdb.base/prelink.exp 2010-07-20 19:34:20.000000000 +0200
@@ -66,6 +66,13 @@ if { [gdb_compile "${srcdir}/${subdir}/$
return -1;
}
+set test "split debug of executable"
+if [gdb_gnu_strip_debug $binfile] {
+ fail $test
+} else {
+ pass $test
+}
+
set found 0
set coredir "${objdir}/${subdir}/coredir.[getpid]"
file mkdir $coredir
@@ -100,7 +107,7 @@ if {[catch "system \"/usr/sbin/prelink -
untested "${testfile}.so was not prelinked, maybe system libraries are not prelinked?"
return 0
}
-catch "system \"/usr/sbin/prelink -qNR --no-exec-shield ${libfile}\""
+catch "system \"/usr/sbin/prelink -qNR --no-exec-shield ${libfile} ${binfile}\""
# Start with a fresh gdb
@@ -117,7 +124,4 @@ gdb_test_multiple "core-file $objdir/$su
}
}
-gdb_exit
-
-return 0
-
+gdb_test "p &bssvar == bssvarp" " = 1" ".dynbss vs. .bss address shift"

View File

@ -0,0 +1,82 @@
http://sourceware.org/ml/gdb-patches/2009-10/msg00142.html
Subject: [patch] Fix GNU/Linux core open: Can't read pathname for load map: Input/output error.
Hi,
GDB currently always prints on loading a core file:
warning: Can't read pathname for load map: Input/output error.
The patch is not nice but it was WONTFIXed on the glibc side in:
http://sourceware.org/ml/libc-alpha/2009-10/msg00001.html
The same message in GDB PR 8882 and glibc PR 387 was for ld-linux.so.2 l_name
but that one is now ignored thanks to IGNORE_FIRST_LINK_MAP_ENTRY.
This fix is intended for Linux system vDSO l_name which is a second entry in
the DSO list.
Regression tested on {x86_86,x86_64-m32,i686}-fedora11-linux-gnu.
Thanks,
Jan
gdb/
2009-10-06 Jan Kratochvil <jan.kratochvil@redhat.com>
Do not print false warning on reading core file with vDSO on GNU/Linux.
* solib-svr4.c (svr4_current_sos): Suppress the warning if
MASTER_SO_LIST is still NULL.
* solib.c (update_solib_list): New variable saved_so_list_head.
Conditionally restart the function.
[ Context backport. ]
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -1097,8 +1097,18 @@ svr4_current_sos (void)
target_read_string (LM_NAME (new), &buffer,
SO_NAME_MAX_PATH_SIZE - 1, &errcode);
if (errcode != 0)
- warning (_("Can't read pathname for load map: %s."),
- safe_strerror (errcode));
+ {
+ /* During the first ever DSO list reading some strings may be
+ unreadable as residing in the ld.so readonly memory not being
+ present in a dumped core file. Delay the error check after
+ the first pass of DSO list scanning when ld.so should be
+ already mapped in and all the DSO list l_name memory gets
+ readable. */
+
+ if (master_so_list () != NULL)
+ warning (_("Can't read pathname for load map: %s."),
+ safe_strerror (errcode));
+ }
else
{
struct build_id *build_id;
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -538,6 +538,7 @@ update_solib_list (int from_tty, struct target_ops *target)
struct target_so_ops *ops = solib_ops (target_gdbarch);
struct so_list *inferior = ops->current_sos();
struct so_list *gdb, **gdb_link;
+ struct so_list *saved_so_list_head = so_list_head;
/* We can reach here due to changing solib-search-path or the
sysroot, before having any inferior. */
@@ -668,6 +669,12 @@ update_solib_list (int from_tty, struct target_ops *target)
observer_notify_solib_loaded (i);
}
}
+
+ /* If this was the very first DSO list scan and we possibly read in ld.so
+ recheck all the formerly unreadable DSO names strings. */
+
+ if (saved_so_list_head == NULL && so_list_head != NULL)
+ update_solib_list (from_tty, target);
}

204
gdb-empty-namespace.patch Normal file
View File

@ -0,0 +1,204 @@
gdb/
2009-12-20 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix compatibility with G++-4.1.
* dwarf2read.c (partial_die_parent_scope): New variable PARENT_NAME.
Ignore parent namespaces with name "::".
(physname_prefix_1): Ignore namespaces with name "::".
gdb/testsuite/
2009-12-20 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.dwarf2/dw2-empty-namespace.exp, gdb.dwarf2/dw2-empty-namespace.S:
New.
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -2355,11 +2355,18 @@ partial_die_parent_scope (struct partial_die_info *pdi,
|| parent->tag == DW_TAG_interface_type
|| parent->tag == DW_TAG_union_type)
{
+ char *parent_name = parent->name;
+
+ /* G++ 4.1 produced DW_TAG_namespace with DW_AT_name "::". */
+ if (parent->tag == DW_TAG_namespace && parent_name != NULL
+ && strcmp (parent_name, "::") == 0)
+ parent_name = NULL;
+
if (grandparent_scope == NULL)
- parent->scope = parent->name;
+ parent->scope = parent_name;
else
parent->scope = typename_concat (&cu->comp_unit_obstack, grandparent_scope,
- parent->name, cu);
+ parent_name, cu);
}
else if (parent->tag == DW_TAG_enumeration_type)
/* Enumerators should not get the name of the enumeration as a prefix. */
@@ -9008,6 +9015,9 @@ physname_prefix_1 (struct ui_file *buf, struct die_info *die,
name = dwarf2_name (die, cu);
if (name == NULL)
name = "(anonymous namespace)";
+ /* G++ 4.1 produced DW_TAG_namespace with DW_AT_name "::". */
+ else if (strcmp (name, "::") == 0)
+ name = NULL;
break;
case DW_TAG_class_type:
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-empty-namespace.S
@@ -0,0 +1,108 @@
+/* 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/>. */
+
+/* Test G++ 4.1 producing DW_TAG_namespace with DW_AT_name "::". */
+
+ .data
+var: .4byte 1
+
+ .section .debug_info
+.Lcu1_begin:
+ /* CU header */
+ .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */
+.Lcu1_start:
+ .2byte 2 /* DWARF Version */
+ .4byte .Labbrev1_begin /* Offset into abbrev section */
+ .byte 4 /* Pointer size */
+
+ /* CU die */
+ .uleb128 1 /* Abbrev: DW_TAG_compile_unit */
+ .ascii "file1.txt\0" /* DW_AT_name */
+ .ascii "GNU C 3.3.3\0" /* DW_AT_producer */
+ .byte 4 /* DW_LANG_C_plus_plus (C++) */
+
+.Ltype_int:
+ .uleb128 2 /* Abbrev: DW_TAG_base_type */
+ .ascii "int\0" /* DW_AT_name */
+ .byte 4 /* DW_AT_byte_size */
+ .byte 5 /* DW_AT_encoding */
+
+ .uleb128 3 /* Abbrev: DW_TAG_namespace */
+ .ascii "::\0" /* DW_AT_name */
+
+ .uleb128 7 /* Abbrev: DW_TAG_variable (location) */
+ .ascii "var\0" /* DW_AT_name */
+ .byte 2f - 1f /* DW_AT_location */
+1: .byte 3 /* DW_OP_addr */
+ .4byte var /* <addr> */
+2: .4byte .Ltype_int-.Lcu1_begin /* DW_AT_type */
+
+ .byte 0 /* End of children of DW_TAG_namespace */
+
+ .byte 0 /* End of children of CU */
+
+.Lcu1_end:
+
+/* Abbrev table */
+ .section .debug_abbrev
+.Labbrev1_begin:
+ .uleb128 1 /* Abbrev code */
+ .uleb128 0x11 /* DW_TAG_compile_unit */
+ .byte 1 /* has_children */
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0x25 /* DW_AT_producer */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0x13 /* DW_AT_language */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+ .uleb128 2 /* Abbrev code */
+ .uleb128 0x24 /* DW_TAG_base_type */
+ .byte 0 /* has_children */
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0xb /* DW_AT_byte_size */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .uleb128 0x3e /* DW_AT_encoding */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+ .uleb128 3 /* Abbrev code */
+ .uleb128 0x39 /* DW_TAG_namespace */
+ .byte 1 /* has_children */
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0x8 /* DW_FORM_string */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+ .uleb128 7 /* Abbrev code (location) */
+ .uleb128 0x34 /* DW_TAG_variable */
+ .byte 0 /* has_children */
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0x2 /* DW_AT_location */
+ .uleb128 0xa /* DW_FORM_block1 */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x13 /* DW_FORM_ref4 */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-empty-namespace.exp
@@ -0,0 +1,43 @@
+# 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/>.
+
+# Test G++ 4.1 producing DW_TAG_namespace with DW_AT_name "::".
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+# For now pick a sampling of likely targets.
+if {![istarget *-*-linux*]
+ && ![istarget *-*-gnu*]
+ && ![istarget *-*-elf*]
+ && ![istarget *-*-openbsd*]
+ && ![istarget arm-*-eabi*]
+ && ![istarget powerpc-*-eabi*]} {
+ return 0
+}
+
+set testfile "dw2-empty-namespace"
+set srcfile ${testfile}.S
+set executable ${testfile}.x
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objdir}/${subdir}/${executable}" object {nodebug}] != "" } {
+ return -1
+}
+
+clean_restart $executable
+
+# `p var' below can work without identified DWARF DIE just based on its ELF symbol.
+# Catch it here as `type = <data variable, no debug info>'.
+gdb_test "ptype var" "type = int"
+
+gdb_test "p var" " = 1"

View File

@ -0,0 +1,99 @@
http://sourceware.org/ml/gdb-cvs/2010-03/msg00066.html
16558457783d71e2856ff2b9ceaa83199d2d9811
### src/gdb/ChangeLog 2010/03/08 07:45:49 1.11442
### src/gdb/ChangeLog 2010/03/08 08:32:49 1.11443
## -1,3 +1,8 @@
+2010-03-08 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * symfile.c (addr_info_make_relative): New variable sect_name, use it.
+ Do not warn on ".gnu.liblist" and ".gnu.conflict".
+
2010-03-08 Joel Brobecker <brobecker@adacore.com>
Memory error when reading wrong core file.
--- src/gdb/symfile.c 2010/03/05 19:32:44 1.275
+++ src/gdb/symfile.c 2010/03/08 08:32:49 1.276
@@ -592,7 +592,8 @@
for (i = 0; i < addrs->num_sections && addrs->other[i].name; i++)
{
- asection *sect = bfd_get_section_by_name (abfd, addrs->other[i].name);
+ const char *sect_name = addrs->other[i].name;
+ asection *sect = bfd_get_section_by_name (abfd, sect_name);
if (sect)
{
@@ -609,8 +610,22 @@
}
else
{
- warning (_("section %s not found in %s"), addrs->other[i].name,
- bfd_get_filename (abfd));
+ /* This section does not exist in ABFD, which is normally
+ unexpected and we want to issue a warning.
+
+ However, the ELF prelinker does create a couple of sections
+ (".gnu.liblist" and ".gnu.conflict") which are marked in the main
+ executable as loadable (they are loaded in memory from the
+ DYNAMIC segment) and yet are not present in separate debug info
+ files. This is fine, and should not cause a warning. Shared
+ libraries contain just the section ".gnu.liblist" but it is not
+ marked as loadable there. */
+
+ if (!(strcmp (sect_name, ".gnu.liblist") == 0
+ || strcmp (sect_name, ".gnu.conflict") == 0))
+ warning (_("section %s not found in %s"), sect_name,
+ bfd_get_filename (abfd));
+
addrs->other[i].addr = 0;
/* SECTINDEX is invalid if ADDR is zero. */
http://sourceware.org/ml/gdb-cvs/2010-03/msg00138.html
http://sourceware.org/ml/gdb-patches/2010-03/msg00535.html
cc3e71651e2fd0168a2d3dd4efc2d3e15fd508dd
### src/gdb/ChangeLog 2010/03/15 03:48:46 1.11479
### src/gdb/ChangeLog 2010/03/15 09:31:30 1.11480
## -1,3 +1,8 @@
+2010-03-15 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * symfile.c (addr_info_make_relative): Ignore also missing ".dynbss"
+ and ".sdynbss". Update the comment.
+
2010-03-15 Jie Zhang <jie@codesourcery.com>
* MAINTAINERS: Update my email address.
--- src/gdb/symfile.c 2010/03/10 18:20:07 1.277
+++ src/gdb/symfile.c 2010/03/15 09:31:34 1.278
@@ -576,16 +576,19 @@
/* This section does not exist in ABFD, which is normally
unexpected and we want to issue a warning.
- However, the ELF prelinker does create a couple of sections
- (".gnu.liblist" and ".gnu.conflict") which are marked in the main
- executable as loadable (they are loaded in memory from the
- DYNAMIC segment) and yet are not present in separate debug info
- files. This is fine, and should not cause a warning. Shared
- libraries contain just the section ".gnu.liblist" but it is not
- marked as loadable there. */
+ However, the ELF prelinker does create a few sections which are
+ marked in the main executable as loadable (they are loaded in
+ memory from the DYNAMIC segment) and yet are not present in
+ separate debug info files. This is fine, and should not cause
+ a warning. Shared libraries contain just the section
+ ".gnu.liblist" but it is not marked as loadable there. There is
+ no other way to identify them than by their name as the sections
+ created by prelink have no special flags. */
if (!(strcmp (sect_name, ".gnu.liblist") == 0
- || strcmp (sect_name, ".gnu.conflict") == 0))
+ || strcmp (sect_name, ".gnu.conflict") == 0
+ || strcmp (sect_name, ".dynbss") == 0
+ || strcmp (sect_name, ".sdynbss") == 0))
warning (_("section %s not found in %s"), sect_name,
bfd_get_filename (abfd));

View File

@ -0,0 +1,27 @@
Problem occurs with python and its get_current_arch () as it selects
selected_frame and current_frame while still inferior_ptid is valid for the
original parent. But since this place it is already attached and later
unwinders try to access it, breaking:
-PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: breakpoint after the first fork
-PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: watchpoint after the first fork
-PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: breakpoint after the second fork
-PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: watchpoint after the second fork
-PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: finish
+FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: breakpoint after the first fork
+FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: watchpoint after the first fork
+FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: breakpoint after the second fork
+FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: watchpoint after the second fork
+FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: finish
--- ./gdb/infrun.c 2009-12-21 20:26:30.000000000 +0100
+++ ./gdb/infrun.c 2009-12-21 20:26:11.000000000 +0100
@@ -375,6 +375,9 @@ follow_fork (void)
}
else
{
+ /* Possibly referenced PARENT is no longer valid. */
+ reinit_frame_cache ();
+
/* This pending follow fork event is now handled, one way
or another. The previous selected thread may be gone
from the lists by now, but if it is still around, need

View File

@ -0,0 +1,117 @@
There was a regression by:
Re: [rfc, v3] Fix frame_id_inner comparison false positives
http://sourceware.org/ml/gdb-patches/2008-08/msg00578.html
http://sourceware.org/ml/gdb-cvs/2008-08/msg00182.html
916dde5d38b45a659514e47942ece70aec04cd78
the part:
* stack.c (return_command): Directly pop the selected frame.
Reproducible on:
hp-diablo-01.rhts.eng.bos.redhat.com
RHEL5.5-Server-20100216.nightly
kernel-2.6.18-187.el5.ia64
Not reproducible on:
hp-bl860c-03.rhts.eng.bos.redhat.com
RHEL-4.8
kernel-2.6.9-89.EL.ia64
To make ia64-tdep.c compilable +/- this stack.c check-in one must apply:
Re: [RFC] Remove addr, endaddr, offset from obj_section
http://sourceware.org/ml/gdb-patches/2008-09/msg00011.html
http://sourceware.org/ml/gdb-cvs/2008-09/msg00009.html
99072369ec3c8f94c9a596e5ce30bf1f1c4bf20e
It is reproducible by:
gdb.base/call-signal-resume.exp
although one must first remove the gdb_assert by:
gdb-infcall-sp-underflow.patch
Reproducer:
set confirm no
set breakpoint pending on
set height 0
set width 0
# testcase from: gdb-6.8-37.el5.src
file gdb.base/call-signals
break stop_one
run
call gen_signal ()
bt
frame 3
return
p/x $sp
break stop_two
info break
p/x $pc
p/x $sp
bt
set debug infrun 1
delete 1
continue
bt
p/x $pc
echo Bug is reproduced if sp is now 0:\n
p/x $sp
kill
quit
--- ./gdb/frame.c 2010-02-23 21:35:35.000000000 +0100
+++ ./gdb/frame.c 2010-02-23 21:46:34.000000000 +0100
@@ -517,7 +517,7 @@ frame_id_eq (struct frame_id l, struct f
a stack overflow strategy that cause the handler to be run on a
different stack. */
-static int
+int
frame_id_inner (struct gdbarch *gdbarch, struct frame_id l, struct frame_id r)
{
int inner;
--- ./gdb/frame.h 2009-09-13 18:28:28.000000000 +0200
+++ ./gdb/frame.h 2010-02-23 21:46:10.000000000 +0100
@@ -708,4 +708,7 @@ extern struct frame_info *create_new_fra
extern int frame_unwinder_is (struct frame_info *fi,
const struct frame_unwind *unwinder);
+extern int frame_id_inner (struct gdbarch *gdbarch, struct frame_id l,
+ struct frame_id r);
+
#endif /* !defined (FRAME_H) */
--- ./gdb/stack.c 2010-02-23 21:35:34.000000000 +0100
+++ ./gdb/stack.c 2010-02-23 21:44:39.000000000 +0100
@@ -1967,8 +1967,29 @@ If you continue, the return value that y
error (_("Not confirmed"));
}
- /* Discard the selected frame and all frames inner-to it. */
- frame_pop (get_selected_frame (NULL));
+ /* NOTE: cagney/2003-01-18: Is this silly? Rather than pop each
+ frame in turn, should this code just go straight to the relevant
+ frame and pop that? */
+
+ /* First discard all frames inner-to the selected frame (making the
+ selected frame current). */
+ {
+ struct frame_id selected_id = get_frame_id (get_selected_frame (NULL));
+ while (!frame_id_eq (selected_id, get_frame_id (get_current_frame ())))
+ {
+ struct frame_info *frame = get_current_frame ();
+ if (frame_id_inner (get_frame_arch (frame), selected_id,
+ get_frame_id (frame)))
+ /* Caught in the safety net, oops! We've gone way past the
+ selected frame. */
+ error (_("Problem while popping stack frames (corrupt stack?)"));
+ frame_pop (get_current_frame ());
+ }
+ }
+
+ /* Second discard the selected frame (which is now also the current
+ frame). */
+ frame_pop (get_current_frame ());
/* Store RETURN_VALUE in the just-returned register set. */
if (return_value != NULL)

View File

@ -0,0 +1,81 @@
http://sourceware.org/ml/gdb-patches/2010-02/msg00515.html
Subject: [patch] infcall: Remove gdb_assert ($sp overflow)
Hi,
set $sp=0
call something()
->
../../gdb/infcall.c:521: internal-error: call_function_by_hand: Assertion
`(gdbarch_inner_than (gdbarch, 1, 2) && sp <= old_sp) || (gdbarch_inner_than
(gdbarch, 2, 1) && sp >= old_sp)' failed.
as $sp - frame == 0xffffsmth which is not lower than $sp.
It must not be gdb_assert(). It can be an error() but I left it just to do:
(gdb) set $sp=0
(gdb) call doubleit (1)
Cannot access memory at address 0xffffffffffffff78
(gdb) set $sp=-1
(gdb) call doubleit (1)
Cannot access memory at address 0xffffffffffffff68
Unaware how inconvenient is an intentional crash of the testcase on some
embedded/non-MMU systems.
No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
Thanks,
Jan
gdb/
2010-02-19 Jan Kratochvil <jan.kratochvil@redhat.com>
* infcall.c (call_function_by_hand): Remove gdb_assert on sp and old_sp.
New comment.
gdb/testsuite/
2010-02-19 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/callfuncs.exp: New tests for $spval 0 and -1. Remove return.
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -518,10 +518,9 @@ call_function_by_hand (struct value *function, int nargs, struct value **args)
/* Stack grows up. */
sp = gdbarch_frame_align (gdbarch, old_sp + 1);
}
- gdb_assert ((gdbarch_inner_than (gdbarch, 1, 2)
- && sp <= old_sp)
- || (gdbarch_inner_than (gdbarch, 2, 1)
- && sp >= old_sp));
+ /* SP may have overflown address zero here from OLD_SP. Memory access
+ functions will probably fail in such case but that is a target's
+ problem. */
}
else
/* FIXME: cagney/2002-09-18: Hey, you loose!
--- a/gdb/testsuite/gdb.base/callfuncs.exp
+++ b/gdb/testsuite/gdb.base/callfuncs.exp
@@ -469,5 +469,18 @@ if {$old_reg_content == $new_reg_content} then {
fail "nested call dummies preserve register contents"
}
-return 0
+# GDB should not crash by internal error on $sp overflow during the inferior
+# call. It is OK it will stop on some: Cannot access memory at address 0x$hex.
+foreach spval {0 -1} {
+ set old_ldprefix $pf_prefix
+ lappend pf_prefix "sp=$spval:"
+
+ gdb_test {set $old_sp = $sp}
+ gdb_test "set \$sp = $spval"
+
+ gdb_test "call doubleit (1)"
+
+ gdb_test {set $sp = $old_sp}
+ set pf_prefix $old_ldprefix
+}

View File

@ -276,12 +276,16 @@ static int spawn (char **argv, int timeout)
assert (signal_chld_hit != 0);
/* Do not unset O_NONBLOCK as a stale child (the whole purpose of this
program) having open its output pty would block us in read_out. */
#if 0
i = fcntl (amaster, F_SETFL, O_RDONLY /* !O_NONBLOCK */);
if (i != 0)
{
perror ("fcntl (amaster, F_SETFL, O_RDONLY /* !O_NONBLOCK */)");
exit (EXIT_FAILURE);
}
#endif
while (read_out (amaster));

View File

@ -0,0 +1,21 @@
pcc regression from:
http://sourceware.org/ml/gdb-patches/2008-12/msg00143.html
gdb/
2009-12-21 Jan Kratochvil <jan.kratochvil@redhat.com>
* breakpoint.c (update_watchpoint): Set B->TYPE to bp_watchpoint before
calling hw_watchpoint_used_count.
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -1152,6 +1152,9 @@ update_watchpoint (struct breakpoint *b, int reparse)
{
int i, mem_cnt, other_type_used;
+ /* Do not count with B twice below. */
+ b->type = bp_watchpoint;
+
i = hw_watchpoint_used_count (bp_hardware_watchpoint,
&other_type_used);
mem_cnt = can_use_hardware_watchpoint (val_chain);

View File

@ -0,0 +1,14 @@
--- gdb-7.0.1/gdb/python/py-type.c-orig 2010-01-14 00:00:29.000000000 +0100
+++ gdb-7.0.1/gdb/python/py-type.c 2010-01-14 00:14:26.000000000 +0100
@@ -177,7 +177,10 @@ convert_field (struct type *type, int fi
if (PyObject_SetAttrString (result, "artificial", arg) < 0)
goto failarg;
- arg = field < TYPE_N_BASECLASSES (type) ? Py_True : Py_False;
+ if (TYPE_CODE (type) == TYPE_CODE_CLASS)
+ arg = field < TYPE_N_BASECLASSES (type) ? Py_True : Py_False;
+ else
+ arg = Py_False;
Py_INCREF (arg);
if (PyObject_SetAttrString (result, "is_base_class", arg) < 0)
goto failarg;

View File

@ -0,0 +1,322 @@
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,26 @@ 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)
+ {
+ char *saved;
+
+ if (rl_prompt)
+ {
+ saved = alloca (strlen (rl_prompt) + 1);
+ strcpy (saved, rl_prompt);
+ }
+ else
+ saved = NULL;
+
+ /* Call RL_CHECK_SIGNALS this way. */
+ rl_callback_handler_remove ();
+ rl_callback_handler_install (saved, 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)'

65
gdb-rhel5-compat.patch Normal file
View File

@ -0,0 +1,65 @@
gdb/linux-nat.c:
- Workaround RHEL-5 kernels for detaching SIGSTOPped processes (BZ 498595).
--- gdb-6.8/gdb-orig/symfile.c 2008-08-21 00:06:50.000000000 +0200
+++ gdb-6.8/gdb/symfile.c 2008-08-21 22:31:00.000000000 +0200
@@ -1456,8 +1456,10 @@ find_separate_debug_file (struct objfile
/* Prevent looping on a stripped .debug file. */
if (build_id_name != NULL && strcmp (build_id_name, objfile->name) == 0)
{
+#if 0 /* RHEL-5 backward behavior compatibility. */
warning (_("\"%s\": separate debug info file has no debug info"),
build_id_name);
+#endif
xfree (build_id_name);
}
else if (build_id_name != NULL)
--- ./gdb/corelow.c 2010-01-01 16:04:34.000000000 +0100
+++ ./gdb/corelow.c 2010-01-01 16:06:26.000000000 +0100
@@ -277,7 +277,7 @@ add_to_thread_list (bfd *abfd, asection
inferior_ptid = ptid; /* Yes, make it current */
}
-static int build_id_core_loads = 1;
+static int build_id_core_loads = 0;
static void
build_id_locate_exec (int from_tty)
--- ./gdb/symfile.c 2010-01-01 16:04:35.000000000 +0100
+++ ./gdb/symfile.c 2010-01-01 16:06:12.000000000 +0100
@@ -1249,7 +1249,7 @@ symbol_file_clear (int from_tty)
#define BUILD_ID_VERBOSE_NONE 0
#define BUILD_ID_VERBOSE_FILENAMES 1
#define BUILD_ID_VERBOSE_BINARY_PARSE 2
-static int build_id_verbose = BUILD_ID_VERBOSE_FILENAMES;
+static int build_id_verbose = BUILD_ID_VERBOSE_NONE;
static void
show_build_id_verbose (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
--- gdb-7.0-orig/gdb/linux-nat.c 2009-12-19 20:53:46.000000000 +0100
+++ gdb-7.0/gdb/linux-nat.c 2009-12-19 20:55:02.000000000 +0100
@@ -1604,8 +1604,22 @@ GPT: lwp %s had signal %s, but it is in
*status = lp->status;
}
- if (*status == 0 && GET_PID (lp->ptid) == pid_was_stopped)
- *status = W_STOPCODE (SIGSTOP);
+ /* Workaround RHEL-5 kernel which has unreliable PTRACE_DETACH, SIGSTOP (that
+ many TIDs are left unstopped). See RH Bug 496732. */
+ if (GET_PID (lp->ptid) == pid_was_stopped)
+ {
+ int err;
+
+ errno = 0;
+ err = kill_lwp (GET_LWP (lp->ptid), SIGSTOP);
+ if (debug_linux_nat)
+ {
+ fprintf_unfiltered (gdb_stdlog,
+ "SC: lwp kill %d %s\n",
+ err,
+ errno ? safe_strerror (errno) : "ERRNO-OK");
+ }
+ }
return 0;
}

405
gdb-rhel5-gcc44.patch Normal file
View File

@ -0,0 +1,405 @@
Some functionality is available on RHEL-5.4+ only with gcc44 and gfortran44 as
the default gcc and gfortran binaries are from gcc-4.1.
--- gdb-7.0/gdb/testsuite/gdb.base/vla.exp-orig 2009-12-20 00:38:13.000000000 +0100
+++ gdb-7.0/gdb/testsuite/gdb.base/vla.exp 2009-12-20 00:54:19.000000000 +0100
@@ -16,7 +16,25 @@
set testfile vla
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+# Temporarily provide compiler=gcc44 saving the original value around.
+
+set board [target_info name]
+if [board_info $board exists compiler] {
+ set old_compiler [board_info $board compiler]
+ unset_board_info compiler
+} elseif [info exists old_compiler] {
+ unset old_compiler
+}
+set_board_info compiler gcc44
+
+set err [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug quiet}]
+
+unset_board_info compiler
+if [info exists old_compiler] {
+ set_board_info compiler $old_compiler
+}
+
+if { $err != "" } {
untested "Couldn't compile test program"
return -1
}
--- gdb-7.0/gdb/testsuite/gdb.base/break-interp.exp-orig 2009-12-20 00:38:13.000000000 +0100
+++ gdb-7.0/gdb/testsuite/gdb.base/break-interp.exp 2009-12-20 01:11:47.000000000 +0100
@@ -31,10 +31,30 @@ if [get_compiler_info ${binfile_lib}] {
return -1
}
+# Temporarily provide compiler=gcc44 saving the original value around.
+# RHEL-5 workaround of its:
+# gcc: -soname: linker input file unused because linking not done
+
+set board [target_info name]
+if [board_info $board exists compiler] {
+ set old_compiler [board_info $board compiler]
+ unset_board_info compiler
+} elseif [info exists old_compiler] {
+ unset old_compiler
+}
+set_board_info compiler gcc44
+
# Use -soname so that it is listed with " => " by ldd and this testcase makes
# a copy of ${binfile_lib} for each prelink variant.
-if {[gdb_compile_shlib ${srcdir}/${subdir}/${srcfile_lib} ${binfile_lib} [list debug additional_flags=-Wl,-soname,${test}.so]] != ""} {
+set err [gdb_compile_shlib ${srcdir}/${subdir}/${srcfile_lib} ${binfile_lib} [list debug additional_flags=-Wl,-soname,${test}.so]]
+
+unset_board_info compiler
+if [info exists old_compiler] {
+ set_board_info compiler $old_compiler
+}
+
+if { $err != "" } {
return -1
}
@@ -483,9 +503,33 @@ foreach ldprelink {NO YES} {
if {$binpie == "YES"} {
lappend opts {additional_flags=-fPIE -pie}
}
- if {[build_executable ${test}.exp [file tail $exec] $srcfile $opts] == -1} {
- continue;
+
+
+ # Temporarily provide compiler=gcc44 saving the original value around.
+ # RHEL-5 workaround of its:
+ # gcc: -rpath: linker input file unused because linking not done
+ # gcc: --dynamic-linker: linker input file unused because linking not done
+
+ set board [target_info name]
+ if [board_info $board exists compiler] {
+ set old_compiler [board_info $board compiler]
+ unset_board_info compiler
+ } elseif [info exists old_compiler] {
+ unset old_compiler
+ }
+ set_board_info compiler gcc44
+
+ set err [build_executable ${test}.exp [file tail $exec] $srcfile $opts]
+
+ unset_board_info compiler
+ if [info exists old_compiler] {
+ set_board_info compiler $old_compiler
}
+
+ if { $err == -1 } {
+ continue
+ }
+
if {$binsepdebug == "SEP"} {
gdb_gnu_strip_debug $exec
# Just a sanity check. As gdb_gnu_strip_debug uses the
--- ./gdb/testsuite/gdb.fortran/common-block.exp 2009-12-15 05:13:56.000000000 +0100
+++ ./gdb/testsuite/gdb.fortran/common-block.exp 2009-12-15 05:21:00.000000000 +0100
@@ -20,7 +20,25 @@ set testfile "common-block"
set srcfile ${testfile}.f90
set binfile ${objdir}/${subdir}/${testfile}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}] != "" } {
+# Temporarily provide f77compiler=gfortran44 saving the original value around.
+
+set board [target_info name]
+if [board_info $board exists f77compiler] {
+ set old_f77compiler [board_info $board f77compiler]
+ unset_board_info f77compiler
+} elseif [info exists old_f77compiler] {
+ unset old_f77compiler
+}
+set_board_info f77compiler gfortran44
+
+set err [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}]
+
+unset_board_info f77compiler
+if [info exists old_f77compiler] {
+ set_board_info f77compiler $old_f77compiler
+}
+
+if { $err != "" } {
untested "Couldn't compile ${srcfile}"
return -1
}
--- ./gdb/testsuite/gdb.fortran/dwarf-stride.exp 2009-12-15 05:13:56.000000000 +0100
+++ ./gdb/testsuite/gdb.fortran/dwarf-stride.exp 2009-12-15 05:20:07.000000000 +0100
@@ -27,7 +27,25 @@
set testfile dwarf-stride
set srcfile ${testfile}.f90
-if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug f77}] } {
+# Temporarily provide f77compiler=gfortran44 saving the original value around.
+
+set board [target_info name]
+if [board_info $board exists f77compiler] {
+ set old_f77compiler [board_info $board f77compiler]
+ unset_board_info f77compiler
+} elseif [info exists old_f77compiler] {
+ unset old_f77compiler
+}
+set_board_info f77compiler gfortran44
+
+set err [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug f77}]
+
+unset_board_info f77compiler
+if [info exists old_f77compiler] {
+ set_board_info f77compiler $old_f77compiler
+}
+
+if $err {
return -1
}
--- ./gdb/testsuite/gdb.fortran/dynamic.exp 2009-12-15 05:13:56.000000000 +0100
+++ ./gdb/testsuite/gdb.fortran/dynamic.exp 2009-12-15 05:17:21.000000000 +0100
@@ -25,7 +25,25 @@ set testfile "dynamic"
set srcfile ${testfile}.f90
set binfile ${objdir}/${subdir}/${testfile}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}] != "" } {
+# Temporarily provide f77compiler=gfortran44 saving the original value around.
+
+set board [target_info name]
+if [board_info $board exists f77compiler] {
+ set old_f77compiler [board_info $board f77compiler]
+ unset_board_info f77compiler
+} elseif [info exists old_f77compiler] {
+ unset old_f77compiler
+}
+set_board_info f77compiler gfortran44
+
+set err [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}]
+
+unset_board_info f77compiler
+if [info exists old_f77compiler] {
+ set_board_info f77compiler $old_f77compiler
+}
+
+if { $err != "" } {
untested "Couldn't compile ${srcfile}"
return -1
}
--- ./gdb/testsuite/gdb.fortran/library-module.exp 2009-12-15 05:13:56.000000000 +0100
+++ ./gdb/testsuite/gdb.fortran/library-module.exp 2009-12-15 05:22:37.000000000 +0100
@@ -25,16 +25,34 @@ if [get_compiler_info not-used] {
return -1
}
-if { [gdb_compile_shlib "${srcdir}/${subdir}/${srclibfile}" $objdir/$subdir/$libfile {debug f77}] != "" } {
- untested "Couldn't compile ${srclibfile}"
- return -1
+# Temporarily provide f77compiler=gfortran44 saving the original value around.
+
+set board [target_info name]
+if [board_info $board exists f77compiler] {
+ set old_f77compiler [board_info $board f77compiler]
+ unset_board_info f77compiler
+} elseif [info exists old_f77compiler] {
+ unset old_f77compiler
}
+set_board_info f77compiler gfortran44
# prepare_for_testing cannot be used as linking with $libfile cannot be passed
# just for the linking phase (and not the source compilation phase). And any
# warnings on ignored $libfile abort the process.
-if { [gdb_compile [list $srcdir/$subdir/$srcfile $objdir/$subdir/$libfile] $objdir/$subdir/$binfile executable {debug f77}] != "" } {
+set err1 [gdb_compile_shlib "${srcdir}/${subdir}/${srclibfile}" $objdir/$subdir/$libfile {debug f77}]
+set err2 [gdb_compile [list $srcdir/$subdir/$srcfile $objdir/$subdir/$libfile] $objdir/$subdir/$binfile executable {debug f77}]
+
+unset_board_info f77compiler
+if [info exists old_f77compiler] {
+ set_board_info f77compiler $old_f77compiler
+}
+
+if { $err1 != "" } {
+ untested "Couldn't compile ${srclibfile}"
+ return -1
+}
+if { $err2 != "" } {
untested "Couldn't compile ${srcfile}"
return -1
}
--- ./gdb/testsuite/gdb.fortran/module.exp 2009-12-15 05:13:56.000000000 +0100
+++ ./gdb/testsuite/gdb.fortran/module.exp 2009-12-15 05:28:49.000000000 +0100
@@ -16,7 +16,25 @@
set testfile "module"
set srcfile ${testfile}.f90
-if { [prepare_for_testing $testfile.exp $testfile $srcfile {debug f77}] } {
+# Temporarily provide f77compiler=gfortran44 saving the original value around.
+
+set board [target_info name]
+if [board_info $board exists f77compiler] {
+ set old_f77compiler [board_info $board f77compiler]
+ unset_board_info f77compiler
+} elseif [info exists old_f77compiler] {
+ unset old_f77compiler
+}
+set_board_info f77compiler gfortran44
+
+set err [prepare_for_testing $testfile.exp $testfile $srcfile {debug f77}]
+
+unset_board_info f77compiler
+if [info exists old_f77compiler] {
+ set_board_info f77compiler $old_f77compiler
+}
+
+if $err {
return -1
}
--- ./gdb/testsuite/gdb.fortran/string.exp 2009-12-15 05:13:56.000000000 +0100
+++ ./gdb/testsuite/gdb.fortran/string.exp 2009-12-15 05:18:13.000000000 +0100
@@ -23,7 +23,25 @@ set testfile "string"
set srcfile ${testfile}.f90
set binfile ${objdir}/${subdir}/${testfile}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}] != "" } {
+# Temporarily provide f77compiler=gfortran44 saving the original value around.
+
+set board [target_info name]
+if [board_info $board exists f77compiler] {
+ set old_f77compiler [board_info $board f77compiler]
+ unset_board_info f77compiler
+} elseif [info exists old_f77compiler] {
+ unset old_f77compiler
+}
+set_board_info f77compiler gfortran44
+
+set err [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}]
+
+unset_board_info f77compiler
+if [info exists old_f77compiler] {
+ set_board_info f77compiler $old_f77compiler
+}
+
+if { $err != "" } {
untested "Couldn't compile ${srcfile}"
return -1
}
--- gdb-7.0/gdb/testsuite/gdb.fortran/omp-step.exp-orig 2009-12-20 09:47:04.000000000 +0100
+++ gdb-7.0/gdb/testsuite/gdb.fortran/omp-step.exp 2009-12-20 09:50:06.000000000 +0100
@@ -15,7 +15,26 @@
set testfile "omp-step"
set srcfile ${testfile}.f90
-if { [prepare_for_testing $testfile.exp $testfile $srcfile {debug f77 additional_flags=-fopenmp}] } {
+
+# Temporarily provide f77compiler=gfortran44 saving the original value around.
+
+set board [target_info name]
+if [board_info $board exists f77compiler] {
+ set old_f77compiler [board_info $board f77compiler]
+ unset_board_info f77compiler
+} elseif [info exists old_f77compiler] {
+ unset old_f77compiler
+}
+set_board_info f77compiler gfortran44
+
+set err [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug f77 additional_flags=-fopenmp}]
+
+unset_board_info f77compiler
+if [info exists old_f77compiler] {
+ set_board_info f77compiler $old_f77compiler
+}
+
+if $err {
return -1
}
--- ./gdb/testsuite/gdb.fortran/derived-type.exp 2009-01-07 13:39:13.000000000 +0100
+++ ./gdb/testsuite/gdb.fortran/derived-type.exp 2009-12-20 12:37:12.000000000 +0100
@@ -26,7 +26,25 @@ set testfile "derived-type"
set srcfile ${testfile}.f90
set binfile ${objdir}/${subdir}/${testfile}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}] != "" } {
+# Temporarily provide f77compiler=gfortran44 saving the original value around.
+
+set board [target_info name]
+if [board_info $board exists f77compiler] {
+ set old_f77compiler [board_info $board f77compiler]
+ unset_board_info f77compiler
+} elseif [info exists old_f77compiler] {
+ unset old_f77compiler
+}
+set_board_info f77compiler gfortran44
+
+set err [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}]
+
+unset_board_info f77compiler
+if [info exists old_f77compiler] {
+ set_board_info f77compiler $old_f77compiler
+}
+
+if { $err != "" } {
untested "Couldn't compile ${srcfile}"
return -1
}
--- ./gdb/testsuite/gdb.fortran/subarray.exp 2009-01-07 13:39:13.000000000 +0100
+++ ./gdb/testsuite/gdb.fortran/subarray.exp 2009-12-20 12:38:00.000000000 +0100
@@ -26,7 +26,25 @@ set testfile "subarray"
set srcfile ${testfile}.f
set binfile ${objdir}/${subdir}/${testfile}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}] != "" } {
+# Temporarily provide f77compiler=gfortran44 saving the original value around.
+
+set board [target_info name]
+if [board_info $board exists f77compiler] {
+ set old_f77compiler [board_info $board f77compiler]
+ unset_board_info f77compiler
+} elseif [info exists old_f77compiler] {
+ unset old_f77compiler
+}
+set_board_info f77compiler gfortran44
+
+set err [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}]
+
+unset_board_info f77compiler
+if [info exists old_f77compiler] {
+ set_board_info f77compiler $old_f77compiler
+}
+
+if { $err != "" } {
untested "Couldn't compile ${srcfile}"
return -1
}
--- ./gdb/testsuite/gdb.threads/tls-sepdebug.exp 2009-12-20 12:22:18.000000000 +0100
+++ ./gdb/testsuite/gdb.threads/tls-sepdebug.exp 2009-12-20 12:39:53.000000000 +0100
@@ -32,7 +32,25 @@ set binshareddebugfile ${objdir}/${subdi
# FIXME: gcc dependency (-Wl,-soname).
-if { [gdb_compile_shlib "${srcdir}/${subdir}/${srcsharedfile}" "${binsharedfile}" [list debug additional_flags=-Wl,-soname=${binsharedbase}]] != "" } {
+# Temporarily provide compiler=gcc44 saving the original value around.
+
+set board [target_info name]
+if [board_info $board exists compiler] {
+ set old_compiler [board_info $board compiler]
+ unset_board_info compiler
+} elseif [info exists old_compiler] {
+ unset old_compiler
+}
+set_board_info compiler gcc44
+
+set err [gdb_compile_shlib "${srcdir}/${subdir}/${srcsharedfile}" "${binsharedfile}" [list debug additional_flags=-Wl,-soname=${binsharedbase}]]
+
+unset_board_info compiler
+if [info exists old_compiler] {
+ set_board_info compiler $old_compiler
+}
+
+if { $err != "" } {
untested "Couldn't compile test library"
return -1
}

70
gdb-stabs-read_args.patch Normal file
View File

@ -0,0 +1,70 @@
http://sourceware.org/ml/gdb-patches/2010-01/msg00142.html
Subject: [patch] Fix crash reading broken stabs
Hi,
seen this stabs from unknown variant of gcc-4.1.2:
1176586 LSYM 0 154 00000000 16682076 basic_string<char,std::char_traits<char>,std::allocator<char> >::_Rep:Tt(0,34)=s12!1,020,(0,35)=xs_Rep_base:;_S_max_size:/2(0,36)=k(0,30):_ZNSs4_Rep11_S_max_sizeE;_S_terminal:/2(0,22):_ZNSs4_Rep11_S_terminalE;_S_empty_rep_storage:/2(0,37)=ar(0,38)=r(0,38);0;037777777777;;0;3;(0,30):_ZNSs4_Rep20_S_empty_rep_storageE;_S_empty_rep::(0,39)=f(0,40)=&(0,34):_ZNSs4_Rep12_S_empty_repEv;2A?;_M_is_leaked::(0,41)=#(0,34),(0,42)=@s8;-16;,(0,43)=*(0,44)=k(0,34),(0,1);:_ZNKSs4_Rep12_M_is_leakedEv;2B.;_M_is_shared::(0,41):_ZNKSs4_Rep12_M_is_sharedEv;2B.;_M_set_leaked::(0,45)=#(0,34),(0,1),(0,33),(0,1);:_ZNSs4_Rep13_M_set_leakedEv;2A.;_M_set_sharable::(0,45):_ZNSs4_Rep15_M_set_sharableEv;2A.;_M_set_length_and_sharable::(0,46)=#(0,34),(0,1),(0,33),(0,25),(0,1);:_ZNSs4_Rep26_M_set_length_and_sharableEj;2A.;_M_refdata::(0,47)=#(0,34),(0,3),(0,33),(0,1);:_ZNSs4_Rep10_M_refdataEv;2A.;_M_grab::(0,48)=#(0,34),(0,3),(0,33),(0,5),(0,5),(0,1);:_ZNSs4_Rep7_M_grabERKSaIcES2_;2A.;_S_create::(0,49)=f(0,33):_ZNSs4_Rep9_S_createEjjRKSaIcE;2A?;_M_dispose::(0,50)=#(0,34),(0,1),(0,33),(0,5),(0,1);:_ZNSs4_Rep10_M_disposeERKSaIcE;2A.;_M_destroy::(0,51)=#(0,34),(0,1),(0,33),(0,5),(0,1);:_ZNSs4_Rep10_M_destroyERKSaIcE;2A.;_M_refcopy::(0,47):_ZNSs4_Rep10_M_refcopyEv;2A.;_M_clone::(0,52)=#(0,34),(0,3),(0,33),(0,5),(0,25),(0,1);:_ZNSs4_Rep8_M_cloneERKSaIcEj;2A.;;
There is a GDB crash at:
_M_is_leaked::(0,41)=#(0,34),(0,42)=@s8;-16;,(0,43)=*(0,44)=k(0,34),(0,1);
^^
+ [...] Some broken stabs
+ output contained `(0,41),(0,42)=@s8;-16;,(0,43),(0,1);' where should
+ have been present ";-16,(0,43)" reference instead. This way the
+ excessive ";" marker prematurely stops the parameters parsing. */
Still I was unable to reproduce producing such STABS output.
So this patch does not try to compensate the - presumably - buggy STABS output
and parses such record incorrectly. But it no longer crashes.
No regressions on {x86_64-m32,i686}-fedora12-linux-gnu
using --target_board unix/-gstabs+/-m32.
Thanks,
Jan
gdb/
2010-01-07 Jan Kratochvil <jan.kratochvil@redhat.com>
* stabsread.c (read_args): Handle zero arguments.
gdb/testsuite/
2010-01-07 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.stabs/weird.def (args93): New.
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -4111,7 +4111,17 @@ read_args (char **pp, int end, struct objfile *objfile, int *nargsp,
}
(*pp)++; /* get past `end' (the ':' character) */
- if (TYPE_CODE (types[n - 1]) != TYPE_CODE_VOID)
+ if (n == 0)
+ {
+ /* We should read at least the THIS parameter here. Some broken stabs
+ output contained `(0,41),(0,42)=@s8;-16;,(0,43),(0,1);' where should
+ have been present ";-16,(0,43)" reference instead. This way the
+ excessive ";" marker prematurely stops the parameters parsing. */
+
+ complaint (&symfile_complaints, _("Invalid (empty) method arguments"));
+ *varargsp = 0;
+ }
+ else if (TYPE_CODE (types[n - 1]) != TYPE_CODE_VOID)
*varargsp = 1;
else
{
--- a/gdb/testsuite/gdb.stabs/weird.def
+++ b/gdb/testsuite/gdb.stabs/weird.def
@@ -880,3 +880,6 @@ var3:
.stabs "sym92:\ !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~",N_LSYM,0,0,0
.stabs "type92:t92=\ !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~",N_LSYM,0,0,0
.stabs "attr92:G392=@\ !#$%&'()*+,-./0123456789:<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~;1",N_GSYM,0,0, 0
+
+# See read_args "Invalid (empty) method arguments" error.
+.stabs "args93:G93=#(0,93),(0,93)=@s8;-16;,(0,93),(0,93);",N_GSYM,0,0,0

View File

@ -0,0 +1,154 @@
http://sourceware.org/ml/gdb-patches/2009-12/msg00364.html
Subject: [patch] related_breakpoint stale ref crash fix
Hi,
getting occasional random:
PASS: gdb.threads/local-watch-wrong-thread.exp: local watchpoint still triggers
PASS: gdb.threads/local-watch-wrong-thread.exp: let thread_function0 return
PASS: gdb.threads/local-watch-wrong-thread.exp: breakpoint on thread_function0's caller
-PASS: gdb.threads/local-watch-wrong-thread.exp: local watchpoint automatically deleted
+ERROR: Process no longer exists
+UNRESOLVED: gdb.threads/local-watch-wrong-thread.exp: local watchpoint automatically deleted
It is even reproducible on HEAD using "input" file below and:
valgrind ../gdb -nx <input
(gdb) (gdb) Breakpoint 6 at 0x400685: file ./gdb.threads/local-watch-wrong-thread.c, line 47.
(gdb) ==31759== Invalid write of size 4
==31759== at 0x601A11: bpstat_check_breakpoint_conditions (breakpoint.c:3482)
==31759== by 0x601C70: bpstat_stop_status (breakpoint.c:3596)
==31759== by 0x65D228: handle_inferior_event (infrun.c:3589)
==31759== by 0x65A563: wait_for_inferior (infrun.c:2281)
==31759== by 0x659AA0: proceed (infrun.c:1883)
==31759== by 0x65300B: continue_1 (infcmd.c:668)
==31759== by 0x653282: continue_command (infcmd.c:760)
==31759== by 0x5C51D8: do_cfunc (cli-decode.c:67)
==31759== by 0x5C824F: cmd_func (cli-decode.c:1738)
==31759== by 0x48335A: execute_command (top.c:450)
==31759== by 0x67273E: command_handler (event-top.c:511)
==31759== by 0x672E53: command_line_handler (event-top.c:736)
==31759== Address 0xbbdc950 is 240 bytes inside a block of size 336 free'd
==31759== at 0x4A04D72: free (vg_replace_malloc.c:325)
==31759== by 0x486E4B: xfree (utils.c:1286)
==31759== by 0x60BC35: delete_breakpoint (breakpoint.c:8708)
==31759== by 0x60BDAF: delete_command (breakpoint.c:8765)
==31759== by 0x5C51D8: do_cfunc (cli-decode.c:67)
==31759== by 0x5C824F: cmd_func (cli-decode.c:1738)
==31759== by 0x48335A: execute_command (top.c:450)
==31759== by 0x67273E: command_handler (event-top.c:511)
==31759== by 0x672E53: command_line_handler (event-top.c:736)
==31759== by 0x672FCF: gdb_readline2 (event-top.c:817)
==31759== by 0x6725F7: stdin_event_handler (event-top.c:433)
==31759== by 0x670CDE: handle_file_event (event-loop.c:812)
==31759==
Watchpoint 4 deleted because the program has left the block in
which its expression is valid.
There is already automatic deletion of RELATED_BREAKPOINT in
map_breakpoint_numbers but "delete breakpoints" (for all the breakpoints)
calls delete_breakpoint from delete_command directly without calling
map_breakpoint_numbers and it does not delete the associated
bp_watchpoint_scope.
I find the attached patch is right for delete_breakpoint itself as such
function should not leave stale references in the leftover data structures.
How well could be other code cleaned up with this patch in place I have not
targeted by this patch.
The existing code expects accessibility of freed memory and discusses the
current stale references problem:
void
delete_breakpoint (struct breakpoint *bpt)
[...]
/* Has this bp already been deleted? This can happen because multiple
lists can hold pointers to bp's. bpstat lists are especial culprits.
One example of this happening is a watchpoint's scope bp. When the
scope bp triggers, we notice that the watchpoint is out of scope, and
delete it. We also delete its scope bp. But the scope bp is marked
"auto-deleting", and is already on a bpstat. That bpstat is then
checked for auto-deleting bp's, which are deleted.
A real solution to this problem might involve reference counts in bp's,
and/or giving them pointers back to their referencing bpstat's, and
teaching delete_breakpoint to only free a bp's storage when no more
references were extent. A cheaper bandaid was chosen. */
if (bpt->type == bp_none)
return;
[...]
bpt->type = bp_none;
xfree (bpt);
}
While fixing this part may be difficult I find the attached patch easy enough
fixing the IMO currently most common crash due to it.
No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
Thanks,
Jan
"input":
set height 0
set width 0
set confirm no
file ../testsuite/gdb.threads/local-watch-wrong-thread
set can-use-hw-watchpoints 1
break main
run
break local-watch-wrong-thread.c:36
continue
delete breakpoints
watch *myp
continue
delete breakpoints
echo MAKE watch\n
watch *myp if trigger != 0
echo MAKE break\n
break local-watch-wrong-thread.c:60
info break
continue
echo DELETE five\n
delete 5
set trigger=1
continue
set *myp=0
break local-watch-wrong-thread.c:47
continue
2009-12-23 Jan Kratochvil <jan.kratochvil@redhat.com>
* breakpoint.c (delete_breakpoint <bpt->related_breakpoint != NULL>):
New.
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -8649,6 +8649,16 @@ delete_breakpoint (struct breakpoint *bpt)
if (bpt->type == bp_none)
return;
+ /* At least avoid this stale reference until the reference counting of
+ breakpoints gets resolved. */
+ if (bpt->related_breakpoint != NULL)
+ {
+ gdb_assert (bpt->related_breakpoint->related_breakpoint == bpt);
+ bpt->related_breakpoint->disposition = disp_del_at_next_stop;
+ bpt->related_breakpoint->related_breakpoint = NULL;
+ bpt->related_breakpoint = NULL;
+ }
+
observer_notify_breakpoint_deleted (bpt->number);
if (breakpoint_chain == bpt)

112
gdb-stale-sectindex.patch Normal file
View File

@ -0,0 +1,112 @@
http://sourceware.org/ml/gdb-patches/2010-02/msg00477.html
Subject: Re: [patch] Fix crash on stale addrinfo->sectindex
On Fri, 19 Feb 2010 04:01:05 +0100, Tom Tromey wrote:
> >>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:
> I think you ought to move this comment as well.
> It appears to just be hanging at the end of a block after the patch.
Yes; forgot.
> This is ok with that change. Thanks.
Checked-in.
On Fri, 19 Feb 2010 04:10:30 +0100, Tom Tromey wrote:
> Oh, by the way, I think this is reasonable for 7.1. It is
> straightforward and fixes a reported crash. If Joel agrees, please put
> it on the branch. Thanks.
OK for the branch?
Thanks,
Jan
http://sourceware.org/ml/gdb-cvs/2010-02/msg00162.html
### src/gdb/ChangeLog 2010/02/19 00:35:53 1.11380
### src/gdb/ChangeLog 2010/02/19 06:19:44 1.11381
## -1,3 +1,10 @@
+2010-02-19 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * symfile.c (addr_info_make_relative): Extend comment. Move SECT to
+ a more inner block. Initialize ADDR by LOWER_OFFSET only if it was
+ found by bfd_get_section_by_name.
+ * symfile.h (struct section_addr_info) <sectindex>: New comment.
+
2010-02-19 Joel Brobecker <brobecker@adacore.com>
* NEWS: Add new "[...] since 7.1" section. Rename the "[...] since
--- src/gdb/symfile.c 2010/02/18 19:17:00 1.272
+++ src/gdb/symfile.c 2010/02/19 06:19:45 1.273
@@ -562,13 +562,13 @@
}
/* Relativize absolute addresses in ADDRS into offsets based on ABFD. Fill-in
- also SECTINDEXes there. */
+ also SECTINDEXes specific to ABFD there. This function can be used to
+ rebase ADDRS to start referencing different BFD than before. */
void
addr_info_make_relative (struct section_addr_info *addrs, bfd *abfd)
{
asection *lower_sect;
- asection *sect;
CORE_ADDR lower_offset;
int i;
@@ -597,25 +597,29 @@
for (i = 0; i < addrs->num_sections && addrs->other[i].name; i++)
{
- if (addrs->other[i].addr != 0)
+ asection *sect = bfd_get_section_by_name (abfd, addrs->other[i].name);
+
+ if (sect)
{
- sect = bfd_get_section_by_name (abfd, addrs->other[i].name);
- if (sect)
+ /* This is the index used by BFD. */
+ addrs->other[i].sectindex = sect->index;
+
+ if (addrs->other[i].addr != 0)
{
addrs->other[i].addr -= bfd_section_vma (abfd, sect);
lower_offset = addrs->other[i].addr;
- /* This is the index used by BFD. */
- addrs->other[i].sectindex = sect->index;
}
else
- {
- warning (_("section %s not found in %s"), addrs->other[i].name,
- bfd_get_filename (abfd));
- addrs->other[i].addr = 0;
- }
+ addrs->other[i].addr = lower_offset;
}
else
- addrs->other[i].addr = lower_offset;
+ {
+ warning (_("section %s not found in %s"), addrs->other[i].name,
+ bfd_get_filename (abfd));
+ addrs->other[i].addr = 0;
+
+ /* SECTINDEX is invalid if ADDR is zero. */
+ }
}
}
--- src/gdb/symfile.h 2010/02/03 14:13:16 1.64
+++ src/gdb/symfile.h 2010/02/19 06:19:45 1.65
@@ -80,6 +80,8 @@
{
CORE_ADDR addr;
char *name;
+
+ /* SECTINDEX must be valid for associated BFD if ADDR is not zero. */
int sectindex;
} other[1];
};

View File

@ -0,0 +1,17 @@
commit 03729380c318738d19256b219bcc03d333dc54bf
Author: Daniel Jacobowitz <dan@debian.org>
Date: Mon Feb 1 17:51:18 2010 +0000
[...]
* gdb.base/interrupt.exp: Match unexpected gdb prompt.
--- a/gdb/testsuite/gdb.base/interrupt.exp
+++ b/gdb/testsuite/gdb.base/interrupt.exp
@@ -167,6 +167,7 @@ if ![file exists $binfile] then {
# here.
gdb_expect {
-re "^(\r\n|)data\r\n(|data\r\n)$" { pass "echo data" }
+ -re "Undefined command.*$gdb_prompt " { fail "echo data" }
timeout { fail "echo data (timeout)" }
eof { fail "echo data (eof)" }
}

View File

@ -0,0 +1,69 @@
http://sourceware.org/ml/gdb-patches/2009-12/msg00473.html
Subject: [patch] testsuite: false MI "unknown output after running" regression
Hi,
the attached patch will turn the results this way:
-KFAIL: gdb.mi/mi-until.exp: until after while loop (unknown output after running) (PRMS: gdb/2104)
+KFAIL: gdb.mi/mi-until.exp: until after while loop (stopped at wrong place) (PRMS: gdb/2104)
-XFAIL: gdb.mi/mi-watch.exp: sw: watchpoint trigger (unknown output after running)
+XFAIL: gdb.mi/mi-watch.exp: sw: watchpoint trigger (stopped at wrong place)
-KFAIL: gdb.mi/mi2-until.exp: until after while loop (unknown output after running) (PRMS: gdb/2104)
+KFAIL: gdb.mi/mi2-until.exp: until after while loop (stopped at wrong place) (PRMS: gdb/2104)
-XFAIL: gdb.mi/mi2-watch.exp: sw: watchpoint trigger (unknown output after running)
+XFAIL: gdb.mi/mi2-watch.exp: sw: watchpoint trigger (stopped at wrong place)
This is a fix of KFAIL-kind regression due to:
commit 26d086d741fb1bb0eee9d50e0bafa7c5e388023f
Re: [RFA] fix *stopped for CLI commands
http://sourceware.org/ml/gdb-patches/2009-02/msg00278.html
http://sourceware.org/ml/gdb-cvs/2009-02/msg00084.html
part:
gdb/testsuite/
2009-02-14 Vladimir Prus <vladimir@codesourcery.com>
* lib/mi-support.exp (mi_expect_stop): Adjust the order of fields.
(mi_expect_interrupt): Likewise.
* gdb.mi/mi-cli.exp: Check that "step" results in proper *stopped
response.
re-wdiff-ed for your convenience as:
verbose -log "mi_expect_stop: expecting: \\*stopped,${r}${a}${bn}[-thread-id=\"$decimal\",stopped-threads=$any,-]frame=\{addr=\"$hex\",func=\"$func\",args=$args,file=\"$any$file\",fullname=\"${fullname_syntax}$file\",line=\"$line\"\}$after_stopped{+,thread-id=\"$decimal\",stopped-threads=$any+}\r\n($thread_selected_re)?$prompt_re"
-re "\\*stopped,${r}${a}${bn}[-thread-id=\"$decimal\",stopped-threads=$any,-]frame=\{addr=\"$hex\",func=\"$func\",args=$args,file=\"$any$file\",fullname=\"${fullname_syntax}$file\",line=\"($line)\"\}$after_stopped{+,thread-id=\"$decimal\",stopped-threads=$any+}\r\n($thread_selected_re)?$prompt_re" {
-re "\\*stopped,${r}${a}${bn}[-thread-id=\"$decimal\",stopped-threads=$any,-]frame=\{addr=\"$hex\",func=\"$any\",args=\[\\\[\{\]$any\[\\\]\}\],file=\"$any\",fullname=\"${fullname_syntax}$any\",line=\"\[0-9\]*\"\}[-$any-]{+thread-id=\"$decimal\",stopped-threads=$any+}\r\n$prompt_re" {
FYI there is: set any "\[^\n\]*"
"stopped at wrong place" is the right kind of KFAIL/XFAIL (tested
gcc-4.1.2-46.el5_4.1.x86_64 and gcc-4.4.2-20.fc12.x86_64) as discussed
in PR gdb/2104.
In the last case there is missing comma (,) after the former patch above.
$after_stopped was IMO missing there even before. It is in use only by
gdb.mi/mi-simplerun.exp and gdb.mi/mi2-simplerun.exp. Also fixed below.
No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
Thanks,
Jan
gdb/testsuite/
2009-12-31 Jan Kratochvil <jan.kratochvil@redhat.com>
* lib/mi-support.exp (mi_expect_stop <stopped at wrong place>): Insert
missing $after_stopped and comma (,) expectation.
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -1038,7 +1038,7 @@ proc mi_expect_stop { reason func args file line extra test } {
pass "$test"
return $expect_out(2,string)
}
- -re "\\*stopped,${r}${a}${bn}frame=\{addr=\"$hex\",func=\"$any\",args=\[\\\[\{\]$any\[\\\]\}\],file=\"$any\",fullname=\"${fullname_syntax}$any\",line=\"\[0-9\]*\"\}thread-id=\"$decimal\",stopped-threads=$any\r\n$prompt_re" {
+ -re "\\*stopped,${r}${a}${bn}frame=\{addr=\"$hex\",func=\"$any\",args=\[\\\[\{\]$any\[\\\]\}\],file=\"$any\",fullname=\"${fullname_syntax}$any\",line=\"\[0-9\]*\"\}$after_stopped,thread-id=\"$decimal\",stopped-threads=$any\r\n$prompt_re" {
verbose -log "got $expect_out(buffer)"
fail "$test (stopped at wrong place)"
return -1

View File

@ -0,0 +1,209 @@
FSF GDB variant is at:
http://sourceware.org/ml/gdb-patches/2010-03/msg00789.html
commit 56b45f494f647360f9d6ff84f12f59c08cbe05af
Author: Sami Wagiaalla <swagiaal@redhat.com>
Date: Mon Mar 29 16:08:58 2010 -0400
Fix using_directive memory leak.
Index: gdb-7.0.1/gdb/buildsym.c
===================================================================
--- gdb-7.0.1.orig/gdb/buildsym.c 2009-07-02 19:21:05.000000000 +0200
+++ gdb-7.0.1/gdb/buildsym.c 2010-04-02 23:41:10.000000000 +0200
@@ -387,6 +387,7 @@ finish_block (struct symbol *symbol, str
}
block_set_using (block, using_directives, &objfile->objfile_obstack);
+ using_directives = NULL;
record_pending_block (objfile, block, opblock);
Index: gdb-7.0.1/gdb/cp-namespace.c
===================================================================
--- gdb-7.0.1.orig/gdb/cp-namespace.c 2010-04-02 23:40:44.000000000 +0200
+++ gdb-7.0.1/gdb/cp-namespace.c 2010-04-02 23:45:37.000000000 +0200
@@ -122,7 +122,8 @@ cp_scan_for_anonymous_namespaces (const
anonymous namespace. So add symbols in it to the
namespace given by the previous component if there is
one, or to the global namespace if there isn't. */
- cp_add_using_directive (dest, src, "", "", 0);
+ cp_add_using_directive (dest, src, "", "", 0,
+ &SYMBOL_SYMTAB (symbol)->objfile->objfile_obstack);
}
/* The "+ 2" is for the "::". */
previous_component = next_component + 2;
@@ -134,11 +135,17 @@ cp_scan_for_anonymous_namespaces (const
}
/* Add a using directive to using_list. If the using directive in question
- has already been added, don't add it twice. */
+ has already been added, don't add it twice.
+ Create a new struct using_direct which imports the namespace SRC into the
+ scope DEST. ALIAS is the name of the imported namespace in the current
+ scope. If ALIAS is NULL then the namespace is known by its original name.
+ The arguments are copied into newly allocated memory so they can be
+ temporaries. */
void
cp_add_using_directive (const char *dest, const char *src, const char* alias,
- const char *declaration, const int line_number)
+ const char *declaration, const int line_number,
+ struct obstack *obstack)
{
struct using_direct *current;
struct using_direct *new;
@@ -148,12 +155,26 @@ cp_add_using_directive (const char *dest
for (current = using_directives; current != NULL; current = current->next)
{
if (strcmp (current->import_src, src) == 0
- && strcmp (current->import_dest, dest) == 0)
+ && strcmp (current->import_dest, dest) == 0
+ && ((alias == NULL && current->alias == NULL)
+ || (alias != NULL && current->alias != NULL
+ && strcmp (alias, current->alias) == 0)))
return;
}
- using_directives = cp_add_using (dest, src, alias, declaration,
- line_number, using_directives);
+ new = OBSTACK_ZALLOC (obstack, struct using_direct);
+
+ new->import_src = obsavestring (src, strlen (src), obstack);
+ new->import_dest = obsavestring (dest, strlen (dest), obstack);
+
+ if (alias != NULL)
+ new->alias = obsavestring (alias, strlen (alias), obstack);
+
+ new->declaration = obsavestring (declaration, strlen (declaration), obstack);
+ new->line_number = line_number;
+
+ new->next = using_directives;
+ using_directives = new;
}
@@ -205,37 +226,6 @@ cp_is_anonymous (const char *namespace)
!= NULL);
}
-/* Create a new struct using direct which imports the namespace SRC
- into the scope DEST. ALIAS is the name of the imported namespace
- in the current scope. If ALIAS is an empty string then the
- namespace is known by its original name.
-
- Set its next member in the linked list to NEXT; allocate all memory
- using xmalloc. It copies the strings, so NAME can be a temporary
- string. */
-
-struct using_direct *
-cp_add_using (const char *dest,
- const char *src,
- const char *alias,
- const char *declaration,
- const int line_number,
- struct using_direct *next)
-{
- struct using_direct *retval;
-
- retval = xmalloc (sizeof (struct using_direct));
- retval->import_src = savestring (src, strlen (src));
- retval->import_dest = savestring (dest, strlen (dest));
- retval->alias = savestring (alias, strlen (alias));
- retval->declaration = savestring (declaration, strlen (declaration));
- retval->line_number = line_number;
- retval->next = next;
- retval->searched = 0;
-
- return retval;
-}
-
/* Make a copy of the using directives in the list pointed to by
USING, using OBSTACK to allocate memory. Free all memory pointed
to by USING via xfree. */
Index: gdb-7.0.1/gdb/cp-support.h
===================================================================
--- gdb-7.0.1.orig/gdb/cp-support.h 2010-04-02 23:40:44.000000000 +0200
+++ gdb-7.0.1/gdb/cp-support.h 2010-04-02 23:41:10.000000000 +0200
@@ -101,14 +101,8 @@ extern void cp_add_using_directive (cons
const char *src,
const char *alias,
const char *declaration,
- const int line_number);
-
-extern struct using_direct *cp_add_using (const char *dest,
- const char *src,
- const char *alias,
- const char *declaration,
- const int line_number,
- struct using_direct *next);
+ const int line_number,
+ struct obstack *obstack);
extern void cp_initialize_namespace (void);
Index: gdb-7.0.1/gdb/dwarf2read.c
===================================================================
--- gdb-7.0.1.orig/gdb/dwarf2read.c 2010-04-02 23:41:04.000000000 +0200
+++ gdb-7.0.1/gdb/dwarf2read.c 2010-04-02 23:42:37.000000000 +0200
@@ -3793,12 +3793,12 @@ read_import_statement (struct die_info *
}
}
- using_directives = cp_add_using (import_prefix,
- canonical_name,
- import_alias,
- imported_declaration,
- line_number,
- using_directives);
+ cp_add_using_directive (import_prefix,
+ canonical_name,
+ import_alias,
+ imported_declaration,
+ line_number,
+ &cu->objfile->objfile_obstack);
}
static void
@@ -5972,7 +5972,12 @@ read_namespace (struct die_info *die, st
if (is_anonymous)
{
const char *previous_prefix = determine_prefix (die, cu);
- cp_add_using_directive (previous_prefix, TYPE_NAME (type), "", "", dwarf2_read_decl_line(die, cu));
+ cp_add_using_directive (previous_prefix,
+ TYPE_NAME (type),
+ "",
+ "",
+ dwarf2_read_decl_line(die, cu),
+ &objfile->objfile_obstack);
}
}
Index: gdb-7.0.1/gdb/testsuite/gdb.cp/gdb2384-base.cc
===================================================================
--- gdb-7.0.1.orig/gdb/testsuite/gdb.cp/gdb2384-base.cc 2009-01-03 06:58:04.000000000 +0100
+++ gdb-7.0.1/gdb/testsuite/gdb.cp/gdb2384-base.cc 2010-04-02 23:41:10.000000000 +0200
@@ -23,6 +23,8 @@ base::base (int _x)
{
}
+using namespace B;
+
int
base::meth ()
{
Index: gdb-7.0.1/gdb/testsuite/gdb.cp/gdb2384-base.h
===================================================================
--- gdb-7.0.1.orig/gdb/testsuite/gdb.cp/gdb2384-base.h 2009-01-03 06:58:04.000000000 +0100
+++ gdb-7.0.1/gdb/testsuite/gdb.cp/gdb2384-base.h 2010-04-02 23:41:10.000000000 +0200
@@ -16,6 +16,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+namespace B{
+ int x;
+}
+
class base
{
public:

View File

@ -0,0 +1,231 @@
http://sourceware.org/ml/gdb-patches/2009-12/msg00394.html
Subject: [patch] Fix watchpoint-at-epilogue 7.0 regression (s390x)
Hi,
attached testcase regressed 6.8->7.0 on some s390x systems.
At the moment PC is at epilogue (after frame pointer got destroyed and PC is
still in the calleed function) we must not try any unwinding as it can try to
unwind a garbage.
Correct way would be to implement epilogue unwinder (such as
amd64_epilogue_frame_unwind or i386_epilogue_frame_unwind ones) but it would
not be so easy on s390x as it would need full prologue-analyzer: After SP gets
restored there can be various instructions before the last jump - GDB needs to
interpret the jump to find the register value where it is going to jump to.
00000048279aa09c <round_and_return>:
[...]
48279aa1b8: eb 6f f0 d0 00 04 lmg %r6,%r15,208(%r15)
48279aa1be: 50 32 10 00 st %r3,0(%r2,%r1) # SP (%r15) is gone hone
48279aa1c2: b3 74 00 00 lzer %r0
48279aa1c6: 07 f4 br %r4 # %r4 is the target
[...]
Just an easy fix is to be more careful and do not try any unwinding if we find
PC is in the epilogue (previous instruction modifies SP=%r15).
It is even a performance optimization and I see no regression risk there.
The specific s390x error is:
#0 throw_error (error=MEMORY_ERROR, fmt=0x8042676a "Cannot access memory at address %s") at exceptions.c:415
#1 in memory_error (status=5, memaddr=0) at corefile.c:220
#2 in read_memory (memaddr=0, myaddr=0x3ffffc7f7f0 "", len=8) at corefile.c:238
#3 in read_memory_unsigned_integer (memaddr=0, len=8, byte_order=BFD_ENDIAN_BIG) at corefile.c:321
#4 in s390_backchain_frame_unwind_cache (this_frame=0x80608958, info=0x80608a08) at s390-tdep.c:1525
#5 in s390_frame_unwind_cache (this_frame=0x80608958, this_prologue_cache=0x80608970) at s390-tdep.c:1572
#6 in s390_frame_this_id (this_frame=0x80608958, this_prologue_cache=0x80608970, this_id=0x806089b8) at s390-tdep.c:1583
#7 in get_frame_id (fi=0x80608958) at frame.c:335
#8 in frame_find_by_id (id={stack_addr = 4398044824952, code_addr = 2147484952, special_addr = 0, stack_addr_p = 1, code_addr_p = 1, special_addr_p = 0, inline_depth = 0}) at frame.c:587
#9 in watchpoint_check (p=0x8095bbc0) at breakpoint.c:3203
#10 in catch_errors (func=0x801262c0 <watchpoint_check>, func_args=0x8095bbc0, errstring=0x80a26410 "Error evaluating expression for watchpoint 3\n", mask=6) at exceptions.c:510
#11 in bpstat_check_watchpoint (bs=0x8095bbc0) at breakpoint.c:3404
#12 in bpstat_stop_status (aspace=0x8061fcb0, bp_addr=2147485040, ptid={pid = 17372, lwp = 17372, tid = 0}) at breakpoint.c:3594
#13 in handle_inferior_event (ecs=0x3ffffc80520) at infrun.c:3588
I did not analyze why 6.8 did not error out, the GDB code is similar there.
No regressions on:
{x86_64,x86_64-m32,i686}-fedora12-linux-gnu (CVS HEAD GDB)
s390x-rhel48-linux-gnu (CVS HEAD GDB)
s390-rhel48-linux-gnu (CVS HEAD GDB)
s390x-rhel54-linux-gnu (Fedora 12 GDB)
s390-rhel54-linux-gnu (Fedora 12 GDB)
Thanks,
Jan
gdb/
2009-12-25 Jan Kratochvil <jan.kratochvil@redhat.com>
* breakpoint.c (watchpoint_check): Check the call
gdbarch_in_function_epilogue_p before calling frame_find_by_id.
Extend the comment.
gdb/testsuite/
2009-12-25 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/watchpoint-cond-gone.exp, gdb.base/watchpoint-cond-gone.c,
gdb.base/watchpoint-cond-gone-stripped.c: New.
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -3200,6 +3200,17 @@ watchpoint_check (void *p)
struct gdbarch *frame_arch = get_frame_arch (frame);
CORE_ADDR frame_pc = get_frame_pc (frame);
+ /* in_function_epilogue_p() returns a non-zero value if we're still
+ in the function but the stack frame has already been invalidated.
+ Since we can't rely on the values of local variables after the
+ stack has been destroyed, we are treating the watchpoint in that
+ state as `not changed' without further checking. Don't mark
+ watchpoints as changed if the current frame is in an epilogue -
+ even if they are in some other frame, our view of the stack
+ is likely to be wrong and frame_find_by_id could error out. */
+ if (gdbarch_in_function_epilogue_p (frame_arch, frame_pc))
+ return WP_VALUE_NOT_CHANGED;
+
fr = frame_find_by_id (b->watchpoint_frame);
within_current_scope = (fr != NULL);
@@ -3216,17 +3227,6 @@ watchpoint_check (void *p)
within_current_scope = 0;
}
- /* in_function_epilogue_p() returns a non-zero value if we're still
- in the function but the stack frame has already been invalidated.
- Since we can't rely on the values of local variables after the
- stack has been destroyed, we are treating the watchpoint in that
- state as `not changed' without further checking. Don't mark
- watchpoints as changed if the current frame is in an epilogue -
- even if they are in some other frame, our view of the stack
- is likely to be wrong. */
- if (gdbarch_in_function_epilogue_p (frame_arch, frame_pc))
- return WP_VALUE_NOT_CHANGED;
-
if (within_current_scope)
/* If we end up stopping, the current frame will get selected
in normal_stop. So this call to select_frame won't affect
--- /dev/null
+++ b/gdb/testsuite/gdb.base/watchpoint-cond-gone-stripped.c
@@ -0,0 +1,23 @@
+/* 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. */
+
+void
+jumper (void (*jumpto) (void))
+{
+ (*jumpto) ();
+}
--- /dev/null
+++ b/gdb/testsuite/gdb.base/watchpoint-cond-gone.c
@@ -0,0 +1,37 @@
+/* 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. */
+
+extern void jumper (void (*jumpto) (void));
+
+static void
+func (void)
+{
+ volatile int c;
+
+ c = 5;
+ c = 10; /* watchpoint-here */
+ c = 20;
+}
+
+int
+main (void)
+{
+ jumper (func);
+
+ return 0;
+}
--- /dev/null
+++ b/gdb/testsuite/gdb.base/watchpoint-cond-gone.exp
@@ -0,0 +1,51 @@
+# 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.
+
+set testfile "watchpoint-cond-gone"
+set srcfile ${testfile}.c
+set srcfilestripped ${testfile}-stripped.c
+set objfilestripped ${objdir}/${subdir}/${testfile}-stripped.o
+set binfile ${objdir}/${subdir}/${testfile}
+
+# We need to generate a function without DWARF to crash older GDB.
+# Stepping into a dynamic function trampoline or stepping out of MAIN may work
+# but it is not a reliable FAIL case.
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfilestripped}" "${objfilestripped}" object {}] != ""
+ || [gdb_compile "${srcdir}/${subdir}/${srcfile} ${objfilestripped}" "${binfile}" executable {debug}] != "" } {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+clean_restart ${testfile}
+
+# Problem does not occur otherwise.
+gdb_test "set can-use-hw-watchpoints 0"
+
+if ![runto_main] {
+ return -1
+}
+
+gdb_breakpoint [gdb_get_line_number "watchpoint-here"]
+gdb_continue_to_breakpoint "Place to set the watchpoint"
+
+# The condition `c == 30' is the subject being tested.
+gdb_test "watch c if c == 30" "" "Place the watchpoint"
+
+# We may stay either in the function itself or only at the first instruction of
+# its caller depending on the epilogue unwinder (or valid epilogue CFI) presence.
+gdb_test "finish" \
+ "Watchpoint .* deleted because the program has left the block in.*which its expression is valid..*in (jumper|func).*" \
+ "Catch the no longer valid watchpoint"

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;
+ }
+ }
}

839
gdb.spec

File diff suppressed because it is too large Load Diff

View File

@ -1,18 +0,0 @@
On x86_64 host with:
pythondir: /usr/lib/python2.6/site-packages/gdb
libdir: /usr/lib64
prefix got set to "/usr/lib" but the code expects a trailing "/" (missing then
one "../" path component).
--- ./libstdc++-v3-python-r151798/hook.in-orig 2009-06-18 21:12:37.000000000 +0200
+++ ./libstdc++-v3-python-r151798/hook.in 2009-09-17 23:37:35.000000000 +0200
@@ -40,7 +40,7 @@ if gdb.current_objfile () is not None:
# In some bizarre configuration we might have found a match in the
# middle of a directory name.
if prefix[-1] != '/':
- prefix = os.path.dirname (prefix)
+ prefix = os.path.dirname (prefix) + '/'
# Strip off the prefix.
pythondir = pythondir[len (prefix):]

View File

@ -1,2 +1,2 @@
1e3a26040dcdd3579d75967085eb92b9 libstdc++-v3-python-r151798.tar.xz
b6ff9aa4c78ca41931052c8658bdabfd gdb-6.8.91.20090925.tar.bz2
53ebade39bfdc1d06744e5188b6438b1 gdb-7.0.1.tar.bz2
04e5c4b1b9e633422cc48990fe61958d libstdc++-v3-python-r155978.tar.bz2