Compare commits

...

16 Commits
master ... f8

Author SHA1 Message Date
Fedora Release Engineering 786363cc80 dist-git conversion 2010-07-28 15:14:01 +00:00
Jan Kratochvil 44759d2053 - Backport of follow-fork-mode child fixes (BZ 435819). 2008-03-13 22:41:46 +00:00
Jan Kratochvil d9433c08c4 - build-id warnings integrated more with rpm and the lists of the warnings
got replaced usually by a single-line `debuginfo-install' advice.
- FIXME: Testsuite needs an update for the new pre-prompt messages.
2008-03-10 10:05:57 +00:00
Jan Kratochvil 9ca8266fa9 - Rename `set debug build-id' as `set build-id-verbose', former level 1
moved to level 2, default value is now 1, use `set build-id-verbose 0'
    now to disable the missing separate debug filenames messages (BZ
    432164).
2008-02-21 21:41:37 +00:00
Jan Kratochvil 016b09ad5a - build-id debug messages print now the library names unconditionally. 2008-01-24 19:46:22 +00:00
Jan Kratochvil b42fa924f5 - Improve the text UI messages for the build-id debug files locating.
- Require now the rpm libraries.
2008-01-24 16:47:06 +00:00
Jan Kratochvil d8f0854cc3 - Fix+test (backport) threading of statically linked inferiors (BZ 314131).
- It requires recent glibc to work in this case properly.
2008-01-11 16:45:57 +00:00
Jan Kratochvil 2ddeb47291 - Fix (backport) PPC biarch (ppc64->ppc) addresses above 2GB (BZ 426613).
- Fix the vendora testcase `attach-32.exp' affecting the other tests
    results.
2007-12-27 23:05:49 +00:00
Jan Kratochvil 2344090082 - Fix crash on parsing duplicite file entries debug info (BZ 426395).
- Fix (#2) readline history for input mode commands like `command' (BZ
    215816).
- Fix documentation on hardware watchpoints wrt multiple threads.
- Rename the patch file for BZ 235197 from its former name BZ 234468.
2007-12-22 14:38:42 +00:00
Jan Kratochvil 337e4aece4 - Testsuite fixes for more stable/comparable results. 2007-12-10 22:59:26 +00:00
Jan Kratochvil bf98f1521f - Fix `errno' resolving on glibc with broken DW_AT_MIPS_linkage_name.
- Imported 6.7 PPC hiding of call-volatile parameter registers.
2007-11-08 22:41:53 +00:00
Jan Kratochvil a2e23a1b95 - Fix hiding unexpected breakpoints on intentional step/next commands.
- Fix s390 compilation warning/failure due to a wrongly sized type-cast.
2007-10-19 00:14:57 +00:00
Jan Kratochvil 42bbf11750 - Set the breakpoints always to all the ctors/dtors variants (BZ 301701).
- Fix non-threaded watchpoints CTRL-C regression on `set follow child'.
- Fix hardware watchpoints after inferior forks-off some process.
2007-10-14 21:11:56 +00:00
Jan Kratochvil 31f942e84f - Fix gdbserver for threaded applications and recent glibc (BZ 328021). 2007-10-12 09:17:46 +00:00
Jan Kratochvil d60484c185 - Fix debug load for sparse assembler files (such as vDSO32 for
i386-on-x86_64).
- Fix a TUI visual corruption due to the build-id warnings (BZ 320061).
- Fixed the kernel i386-on-x86_64 VDSO loading (producing `Lowest section
    in').
2007-10-10 23:23:18 +00:00
Kevin Fenzi c9671303f2 Initialize branch F-8 for gdb 2007-10-08 18:48:43 +00:00
25 changed files with 4372 additions and 413 deletions

View File

View File

@ -1,6 +0,0 @@
# Makefile for source rpm: gdb
# $Id: Makefile,v 1.1 2004/09/09 05:00:56 cvsdist Exp $
NAME := gdb
SPECFILE = $(firstword $(wildcard *.spec))
include ../common/Makefile.common

View File

@ -1,9 +1,13 @@
2005-07-21 Jeff Johnston <jjohnstn@redhat.com>
* gdb.base/attach-32.exp: New test for attaching in 32-bit
mode on 64-bit systems.
* gdb.base/attach-32.c: Ditto.
* gdb.base/attach-32b.c: Ditto.
* gdb.base/attach-32.exp: New test for attaching in 32-bit
mode on 64-bit systems.
* gdb.base/attach-32.c: Ditto.
* gdb.base/attach-32b.c: Ditto.
2007-12-26 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/attach-32.exp: Fix forgotten $GDBFLAGS as set.
--- gdb-6.3/gdb/testsuite/gdb.base/attach-32.c.fix3 2005-07-21 14:23:50.000000000 -0400
+++ gdb-6.3/gdb/testsuite/gdb.base/attach-32.c 2005-07-21 14:05:56.000000000 -0400
@ -30,7 +34,7 @@
+}
--- gdb-6.3/gdb/testsuite/gdb.base/attach-32.exp.fix3 2005-07-21 14:23:45.000000000 -0400
+++ gdb-6.3/gdb/testsuite/gdb.base/attach-32.exp 2005-07-21 17:58:28.000000000 -0400
@@ -0,0 +1,247 @@
@@ -0,0 +1,252 @@
+# Copyright 2005 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
@ -251,9 +255,12 @@
+ # different due to the way fork/exec works.
+ set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ]
+}
+set GDBFLAGS "--pid=$testpid"
+
+set GDBFLAGS_orig $GDBFLAGS
+set GDBFLAGS "--pid=$testpid"
+gdb_start
+set GDBFLAGS $GDBFLAGS_orig
+
+gdb_reinitialize_dir $srcdir/$subdir
+
+# This is a test of gdb's ability to attach to a running process.
@ -270,9 +277,11 @@
+ # different due to the way fork/exec works.
+ set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ]
+}
+set GDBFLAGS "--pid=$testpid"
+
+set GDBFLAGS_orig $GDBFLAGS
+set GDBFLAGS "--pid=$testpid"
+gdb_start
+set GDBFLAGS $GDBFLAGS_orig
+
+gdb_reinitialize_dir $srcdir/$subdir
+do_call_attach_tests

View File

@ -5,10 +5,28 @@
* linespec.c (add_minsym_members): Support also the `$allocate' and
`$delete' variants.
2007-10-05 Jan Kratochvil <jan.kratochvil@redhat.com>
* linespec.c (add_minsym_members): Support also the `$allocate' and
`$delete' variants.
(decode_variable): Renamed to ...
(decode_variable_1) ... here, its parameter NOT_FOUND_PTR and its
exception throwing was moved to ...
(decode_variable_not_found): ... a new function here.
(decode_variable): New function.
Index: gdb-6.5/gdb/linespec.c
===================================================================
--- gdb-6.5.orig/gdb/linespec.c 2006-01-10 20:14:43.000000000 -0200
+++ gdb-6.5/gdb/linespec.c 2006-07-07 01:04:56.000000000 -0300
@@ -37,6 +37,7 @@
#include "objc-lang.h"
#include "linespec.h"
#include "exceptions.h"
+#include "gdb_assert.h"
/* We share this one with symtab.c, but it is not exported widely. */
@@ -75,7 +75,8 @@ static struct symtabs_and_lines find_met
struct symbol *sym_class);
@ -438,3 +456,191 @@ Index: gdb-6.5/gdb/linespec.c
return i1;
}
@@ -1976,12 +2021,13 @@ decode_dollar (char *copy, int funfirstl
and do not issue an error message. */
static struct symtabs_and_lines
-decode_variable (char *copy, int funfirstline, char ***canonical,
- struct symtab *file_symtab, int *not_found_ptr)
+decode_variable_1 (char *copy, int funfirstline, char ***canonical,
+ struct symtab *file_symtab)
{
struct symbol *sym;
/* The symtab that SYM was found in. */
struct symtab *sym_symtab;
+ struct symtabs_and_lines retval;
struct minimal_symbol *msymbol;
@@ -2001,8 +2047,25 @@ decode_variable (char *copy, int funfirs
msymbol = lookup_minimal_symbol (copy, NULL, NULL);
if (msymbol != NULL)
- return minsym_found (funfirstline, msymbol);
+ {
+ retval = minsym_found (funfirstline, msymbol);
+
+ /* Create a `filename:linkage_symbol_name' reference. */
+ if (file_symtab == 0)
+ build_canonical_line_spec (retval.sals, SYMBOL_LINKAGE_NAME (msymbol),
+ canonical);
+
+ return retval;
+ }
+ retval.nelts = 0;
+ retval.sals = NULL;
+ return retval;
+}
+
+static void
+decode_variable_not_found (char *copy, int *not_found_ptr)
+{
if (!have_full_symbols () &&
!have_partial_symbols () && !have_minimal_symbols ())
error (_("No symbol table is loaded. Use the \"file\" command."));
@@ -2010,6 +2064,132 @@ decode_variable (char *copy, int funfirs
throw_error (NOT_FOUND_ERROR, _("Function \"%s\" not defined."), copy);
}
+/* Wrapper of DECODE_VARIABLE_1 collecting the results for all the found
+ VARIANTS of the symbol COPY. */
+
+static struct symtabs_and_lines
+decode_variable (char *copy, int funfirstline, char ***canonical,
+ struct symtab *file_symtab, int *not_found_ptr)
+{
+ char *src;
+ char *src_point;
+ char *s, *point;
+ /* Keep "" last as the trimming part always matches it. */
+ const char *variants[] = {"$base","$allocate","$delete",""};
+ int i;
+ char *dst, *dst_point;
+ struct
+ {
+ struct symtabs_and_lines sals;
+ char **canonical;
+ } found[ARRAY_SIZE (variants)];
+ struct symtabs_and_lines retval_sals;
+ char **retval_canonical = NULL; /* Shut up GCC. */
+ int filled;
+ int canonicals = 0; /* Shut up GCC. */
+
+ src = copy;
+ src_point = strchr (src, '(');
+ if (src_point == NULL)
+ {
+ struct symtabs_and_lines sals;
+
+ sals = decode_variable_1 (src, funfirstline, canonical, file_symtab);
+ if (sals.nelts > 0)
+ return sals;
+ decode_variable_not_found (copy, not_found_ptr);
+ /* NOTREACHED */
+ }
+
+ dst = xmalloc (strlen (src) + strlen ("$allocate") + 1);
+ dst_point = dst + (src_point - src);
+
+ memcpy (dst, src, src_point - src);
+
+ /* Trim out any variant markers there first. */
+ for (i = 0; i < ARRAY_SIZE (variants); i++)
+ {
+ size_t len = strlen (variants[i]);
+
+ if (dst_point - dst >= len
+ && memcmp (dst_point - len, variants[i], len) == 0)
+ {
+ dst_point -= len;
+ /* In fact it should not be needed here. */
+ break;
+ }
+ }
+
+ filled = 0;
+ /* And now try to append all of them. */
+ for (i = 0; i < ARRAY_SIZE (variants); i++)
+ {
+ size_t len = strlen (variants[i]);
+ struct minimal_symbol *minsym2;
+
+ memcpy (dst_point, variants[i], len);
+ strcpy (dst_point + len, src_point);
+
+ found[i].canonical = NULL;
+ found[i].sals = decode_variable_1 (dst, funfirstline,
+ (canonical == NULL ? NULL
+ : &found[i].canonical),
+ file_symtab);
+ filled += found[i].sals.nelts;
+ }
+ xfree (dst);
+ if (filled == 0)
+ {
+ decode_variable_not_found (copy, not_found_ptr);
+ /* NOTREACHED */
+ }
+
+ retval_sals.nelts = filled;
+ retval_sals.sals = xmalloc (filled * sizeof *retval_sals.sals);
+ if (canonical != NULL)
+ {
+ retval_canonical = xmalloc (filled * sizeof *retval_canonical);
+ canonicals = 0;
+ }
+ filled = 0;
+ for (i = 0; i < ARRAY_SIZE (variants); i++)
+ {
+ memcpy (&retval_sals.sals[filled], found[i].sals.sals,
+ found[i].sals.nelts * sizeof *retval_sals.sals);
+ xfree (found[i].sals.sals);
+ if (canonical != NULL)
+ {
+ if (found[i].canonical == NULL)
+ memset (&retval_canonical[filled], 0,
+ found[i].sals.nelts * sizeof *retval_canonical);
+ else
+ {
+ int j;
+
+ memcpy (&retval_canonical[filled], found[i].canonical,
+ found[i].sals.nelts * sizeof *retval_canonical);
+ for (j = 0; j < found[i].sals.nelts; j++)
+ if (found[i].canonical[j] != NULL)
+ canonicals++;
+ xfree (found[i].canonical);
+ }
+ }
+ filled += found[i].sals.nelts;
+ }
+ gdb_assert (filled == retval_sals.nelts);
+
+ if (canonical != NULL)
+ {
+ if (canonicals != 0)
+ *canonical = retval_canonical;
+ else
+ {
+ *canonical = NULL;
+ xfree (retval_canonical);
+ }
+ }
+ return retval_sals;
+}
diff -u -rup gdb-6.6-orig/gdb/Makefile.in gdb-6.6/gdb/Makefile.in
--- gdb-6.6-orig/gdb/Makefile.in 2007-10-05 15:22:37.000000000 +0200
+++ gdb-6.6/gdb/Makefile.in 2007-10-05 16:29:10.000000000 +0200
@@ -2266,7 +2266,7 @@ libunwind-frame.o: libunwind-frame.c $(d
linespec.o: linespec.c $(defs_h) $(symtab_h) $(frame_h) $(command_h) \
$(symfile_h) $(objfiles_h) $(source_h) $(demangle_h) $(value_h) \
$(completer_h) $(cp_abi_h) $(parser_defs_h) $(block_h) \
- $(objc_lang_h) $(linespec_h) $(exceptions_h)
+ $(objc_lang_h) $(linespec_h) $(exceptions_h) $(gdb_assert_h)
linux-fork.o: linux-fork.c $(defs_h) $(inferior_h) $(regcache_h) $(gdbcmd_h) \
$(infcall_h) $(gdb_assert_h) $(gdb_string_h) $(linux_fork_h) \
$(linux_nat_h)

View File

@ -1,3 +1,14 @@
[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.
Index: gdb-6.6/gdb/doc/observer.texi
===================================================================
--- gdb-6.6.orig/gdb/doc/observer.texi
@ -17,7 +28,7 @@ Index: gdb-6.6/gdb/linux-nat.c
===================================================================
--- gdb-6.6.orig/gdb/linux-nat.c
+++ gdb-6.6/gdb/linux-nat.c
@@ -803,11 +803,23 @@ iterate_over_lwps (int (*callback) (stru
@@ -803,11 +803,26 @@ iterate_over_lwps (int (*callback) (stru
{
struct lwp_info *lp, *lpnext;
@ -36,8 +47,11 @@ Index: gdb-6.6/gdb/linux-nat.c
+ {
+ /* We are calling iterate_over_lwps for a non-threaded program.
+ Initialize the lwp list to the inferior's ptid. */
+ lp = add_lwp (BUILD_LWP (GET_PID (inferior_ptid),
+ GET_PID (inferior_ptid)));
+ gdb_assert (!is_lwp (inferior_ptid));
+
+ inferior_ptid = BUILD_LWP (GET_PID (inferior_ptid),
+ GET_PID (inferior_ptid));
+ lp = add_lwp (inferior_ptid);
if ((*callback) (lp, data))
- return lp;
+ return lp;
@ -112,3 +126,95 @@ Index: gdb-6.6/gdb/target.h
/* Does target have enough data to do a run or attach command? */
diff -u -u -X /home/jkratoch/.diffi.list -rup gdb-6.6-orig/gdb/testsuite/gdb.base/follow-child.c gdb-6.6/gdb/testsuite/gdb.base/follow-child.c
--- gdb-6.6-orig/gdb/testsuite/gdb.base/follow-child.c 2007-10-13 19:24:58.000000000 +0200
+++ gdb-6.6/gdb/testsuite/gdb.base/follow-child.c 2007-10-13 19:11:08.000000000 +0200
@@ -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;
+}
diff -u -u -X /home/jkratoch/.diffi.list -rup gdb-6.6-orig/gdb/testsuite/gdb.base/follow-child.exp gdb-6.6/gdb/testsuite/gdb.base/follow-child.exp
--- gdb-6.6-orig/gdb/testsuite/gdb.base/follow-child.exp 2007-10-13 19:24:58.000000000 +0200
+++ gdb-6.6/gdb/testsuite/gdb.base/follow-child.exp 2007-10-13 19:24:21.000000000 +0200
@@ -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
+ }
+}

View File

@ -19,6 +19,8 @@ Index: gdb/testsuite/ChangeLog
* gdb.cp/constructortest.exp: Test BREAKPOINT_RE_SET for multiple PCs
by PIE.
* gdb.cp/constructortest.exp: Handle the change of settings breakpoints
always at all the ctor/dtor variants.
--- gdb-6.3/gdb/testsuite/gdb.cp/constructortest.cc.fix Fri Jan 21 17:06:56 2005
+++ gdb-6.3/gdb/testsuite/gdb.cp/constructortest.cc Fri Jan 21 17:05:18 2005
@ -124,7 +126,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,145 @@
@@ -0,0 +1,148 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2005, 2007 Free Software Foundation, Inc.
@ -222,6 +224,9 @@ Index: gdb/testsuite/ChangeLog
+gdb_test "break $second_line_dtor" ".*$second_line_dtor.*$second_line_dtor.*Multiple breakpoints were set.*" "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.
+gdb_continue_to_breakpoint "Second line ~A"
+gdb_test "bt" "#0.*A.*#1.*main.*" "Verify in A::~A second line #2"
+gdb_continue_to_breakpoint "Second line ~A"
+gdb_test "bt" "#0.*A.*#1.*B.*#2.*main.*" "Verify in not-in-charge A::~A second line"
+

View File

@ -1,351 +1,437 @@
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=109921
2007-01-21 Jan Kratochvil <jan.kratochvil@redhat.com>
Daniel Jacobowitz <dan@codesourcery.com>
2007-01-09 Jan Kratochvil <jan.kratochvil@redhat.com>
* buildsym.c (start_subfile_index): Renamed `start_subfile' now
supporting the FILE_INDEX parameter.
(start_subfile): Backward compatible stub for `start_subfile_index'.
(end_symtab): Resolve new SYMBOL.FILE.SYMTAB from SYMBOL.FILE.INDEX.
Substitute possibly missing DIRNAME from the CU's main file DIRNAME.
Clear `subfiles' variable as its data have been deallocated.
* buildsym.h (struct subfile): New field `file_index'.
(start_subfile_index): New prototype.
* dwarf2read.c (add_file_name): Ensure subfile has been founded.
(dwarf_decode_lines): Specify the new FILE_INDEX parameter.
(dwarf2_start_subfile): New FILE_INDEX parameter.
(new_symbol): Extract `DW_AT_decl_file' DWARF 2 information entry.
* symtab.c (lookup_symbol): Override by the new SYMBOL.FILE.SYMTAB.
* buildsym.c (end_symtab): Use preallocated symtab if available.
Fill in SYMBOL_SYMTAB.
* buildsym.h (struct subfile): Add symtab member.
* dwarf2read.c (struct dwarf2_cu): Add line_header.
(struct file_entry): Add symtab.
(free_cu_line_header): New function.
(read_file_scope): Use it. Save line_header in the cu. Process
lines before DIEs.
(add_file_name): Initialize new symtab member.
(dwarf_decode_lines): Create symtabs for included files.
(new_symbol): Set SYMBOL_SYMTAB.
* symtab.c (lookup_symbol): Use SYMBOL_SYMTAB.
(search_symbols): Likewise.
* symtab.h (struct symbol): New fields FILE.INDEX and FILE.SYMTAB.
(SYMBOL_FILE_INDEX, SYMBOL_FILE_SYMTAB): New macros.
* symtab.h (struct symbol): Add symtab member.
(SYMBOL_SYMTAB): Define.
2007-01-21 Jan Kratochvil <jan.kratochvil@redhat.com>
Daniel Jacobowitz <dan@codesourcery.com>
* gdb.base/included.c, gdb.base/included.exp,
gdb.base/included.h: New files.
Index: gdb-6.6/gdb/buildsym.c
===================================================================
--- gdb-6.6.orig/gdb/buildsym.c 2006-08-25 18:32:32.000000000 +0200
+++ gdb-6.6/gdb/buildsym.c 2007-01-20 13:59:48.000000000 +0100
@@ -540,7 +540,7 @@ make_blockvector (struct objfile *objfil
the directory in which it resides (or NULL if not known). */
void
-start_subfile (char *name, char *dirname)
+start_subfile_index (char *name, char *dirname, unsigned file_index)
{
struct subfile *subfile;
@@ -552,6 +552,17 @@ start_subfile (char *name, char *dirname
if (FILENAME_CMP (subfile->name, name) == 0)
{
current_subfile = subfile;
+
+ if (subfile->file_index != 0 && file_index != 0
+ && subfile->file_index != file_index)
+ complaint (&symfile_complaints, _("Filenames indexing conflict: "
+ "name \"%s\" dir \"%s\" index %u vs. "
+ "name \"%s\" dir \"%s\" index %u"),
+ subfile->name, subfile->dirname, subfile->file_index,
+ name, dirname, file_index);
+ if (subfile->file_index == 0)
+ subfile->file_index = file_index;
+
return;
}
}
@@ -567,6 +578,7 @@ start_subfile (char *name, char *dirname
current_subfile = subfile;
/* Save its name and compilation directory name */
+ subfile->file_index = file_index;
subfile->name = (name == NULL) ? NULL : savestring (name, strlen (name));
subfile->dirname =
(dirname == NULL) ? NULL : savestring (dirname, strlen (dirname));
@@ -622,6 +634,13 @@ start_subfile (char *name, char *dirname
}
}
+/* Backward compatibility. */
+void
+start_subfile (char *name, char *dirname)
+{
+ start_subfile_index (name, dirname, 0);
+}
+
/* For stabs readers, the first N_SO symbol is assumed to be the
source file name, and the subfile struct is initialized using that
assumption. If another N_SO symbol is later seen, immediately
@@ -821,9 +840,12 @@ end_symtab (CORE_ADDR end_addr, struct o
{
struct symtab *symtab = NULL;
struct blockvector *blockvector;
- struct subfile *subfile;
+ struct subfile *subfile, *subfile_main;
struct context_stack *cstk;
struct subfile *nextsub;
+ int subfiles_count;
+ struct symtab **file_index_to_symtab;
+ size_t file_index_to_symtab_size;
/* Finish the lexical context of the last function in the file; pop
the context stack. */
@@ -921,6 +943,18 @@ end_symtab (CORE_ADDR end_addr, struct o
#endif
PROCESS_LINENUMBER_HOOK (); /* Needed for xcoff. */
+ /* Get the last subfile s SUBFILE_MAIN which is the main file of CU.
+ Count SUBFILES_COUNT.
+ Start with 1 as we do not iterate past the last item. */
+ subfiles_count = 1;
+ for (subfile_main = subfiles; subfile_main && subfile_main->next;
+ subfile_main = subfile_main->next)
+ subfiles_count++;
+
+ file_index_to_symtab_size = sizeof (*file_index_to_symtab) * subfiles_count;
+ file_index_to_symtab = xmalloc (file_index_to_symtab_size);
+ memset ((char *) file_index_to_symtab, 0, file_index_to_symtab_size);
+
/* Now create the symtab objects proper, one for each subfile. */
/* (The main file is the last one on the chain.) */
@@ -981,6 +1015,16 @@ end_symtab (CORE_ADDR end_addr, struct o
strlen (subfile->dirname) + 1);
strcpy (symtab->dirname, subfile->dirname);
RCS file: /cvs/src/src/gdb/buildsym.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- src/gdb/buildsym.c 2007/01/09 17:58:50 1.45
+++ src/gdb/buildsym.c 2007/01/21 16:49:40 1.46
@@ -959,7 +959,10 @@
}
+ /* Non-primary subfiles may miss COMP_DIR resulting in NULL
+ DIRNAME and so default it from the CU file - SUBFILE_MAIN. */
+ else if (subfile_main->dirname)
+ {
+ /* Reallocate the dirname on the symbol obstack */
+ symtab->dirname = (char *)
+ obstack_alloc (&objfile->objfile_obstack,
+ strlen (subfile_main->dirname) + 1);
+ strcpy (symtab->dirname, subfile_main->dirname);
+ }
else
{
symtab->dirname = NULL;
@@ -1009,6 +1053,13 @@ end_symtab (CORE_ADDR end_addr, struct o
but the main file. */
symtab->primary = 0;
+
+ /* It may be zero for files unlisted in File Table. */
+ if (subfile->file_index)
+ {
+ gdb_assert (subfile->file_index <= subfiles_count);
+ file_index_to_symtab[subfile->file_index - 1] = symtab;
+ }
}
if (subfile->name != NULL)
{
@@ -1037,9 +1088,40 @@ end_symtab (CORE_ADDR end_addr, struct o
/* Now, allocate a symbol table. */
- symtab = allocate_symtab (subfile->name, objfile);
+ if (subfile->symtab == NULL)
+ symtab = allocate_symtab (subfile->name, objfile);
+ else
+ symtab = subfile->symtab;
/* Fill in its components. */
symtab->blockvector = blockvector;
@@ -1048,6 +1051,26 @@
symtab->primary = 1;
}
+ /* Resolve `struct symbol.file.index' into `struct symbol.file.symtab'. */
+ /* Default any symbols without a specified symtab to the primary
+ symtab. */
+ if (blockvector)
+ {
+ int block_i;
+
+ for (block_i = 0; block_i < BLOCKVECTOR_NBLOCKS (blockvector); block_i++)
+ {
+ struct block *block = BLOCKVECTOR_BLOCK (blockvector, block_i);
+ struct symbol *sym;
+ struct dict_iterator iter;
+
+ for (sym = dict_iterator_first (BLOCK_DICT
+ (BLOCKVECTOR_BLOCK (blockvector, block_i)), &iter);
+ for (sym = dict_iterator_first (BLOCK_DICT (block), &iter);
+ sym != NULL;
+ sym = dict_iterator_next (&iter))
+ {
+ /* Beware the ordering as `sym->file' is a union. */
+ if (SYMBOL_FILE_INDEX (sym)
+ && file_index_to_symtab[SYMBOL_FILE_INDEX (sym) - 1])
+ SYMBOL_FILE_SYMTAB (sym) = file_index_to_symtab
+ [SYMBOL_FILE_INDEX (sym) - 1];
+ else
+ {
+ /* Default to the primary symbol table, never use NULL. */
+ SYMBOL_FILE_SYMTAB (sym) = symtab;
+ }
+ }
+ if (SYMBOL_SYMTAB (sym) == NULL)
+ SYMBOL_SYMTAB (sym) = symtab;
+ }
+ }
+
+ xfree (file_index_to_symtab);
last_source_file = NULL;
current_subfile = NULL;
pending_macros = NULL;
+ subfiles = NULL;
return symtab;
}
Index: gdb-6.6/gdb/buildsym.h
===================================================================
--- gdb-6.6.orig/gdb/buildsym.h 2005-12-17 23:33:59.000000000 +0100
+++ gdb-6.6/gdb/buildsym.h 2007-01-20 13:59:48.000000000 +0100
@@ -63,6 +63,7 @@ EXTERN CORE_ADDR last_source_start_addr;
struct subfile
{
struct subfile *next;
+ unsigned file_index;
char *name;
char *dirname;
struct linetable *line_vector;
@@ -240,6 +241,9 @@ extern void finish_block (struct symbol
RCS file: /cvs/src/src/gdb/buildsym.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- src/gdb/buildsym.h 2007/01/09 17:58:50 1.15
+++ src/gdb/buildsym.h 2007/01/21 16:49:40 1.16
@@ -70,6 +70,7 @@
enum language language;
char *producer;
char *debugformat;
+ struct symtab *symtab;
};
extern void really_free_pendings (void *dummy);
EXTERN struct subfile *subfiles;
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.211
retrieving revision 1.212
diff -u -r1.211 -r1.212
--- src/gdb/dwarf2read.c 2007/01/09 17:58:50 1.211
+++ src/gdb/dwarf2read.c 2007/01/21 16:49:40 1.212
@@ -341,6 +341,9 @@
partial symbol tables do not have dependencies. */
htab_t dependencies;
+extern void start_subfile_index (char *name, char *dirname,
+ unsigned file_index);
+ /* Header data from the line table, during full symbol processing. */
+ struct line_header *line_header;
+
extern void start_subfile (char *name, char *dirname);
/* Mark used when releasing cached dies. */
unsigned int mark : 1;
extern void patch_subfile_names (struct subfile *subfile, char *name);
Index: gdb-6.6/gdb/dwarf2read.c
===================================================================
--- gdb-6.6.orig/gdb/dwarf2read.c 2007-01-20 06:43:04.000000000 +0100
+++ gdb-6.6/gdb/dwarf2read.c 2007-01-20 14:00:12.000000000 +0100
@@ -853,7 +853,7 @@ static struct line_header *(dwarf_decode
static void dwarf_decode_lines (struct line_header *, char *, bfd *,
struct dwarf2_cu *, struct partial_symtab *);
@@ -432,6 +435,7 @@
unsigned int mod_time;
unsigned int length;
int included_p; /* Non-zero if referenced by the Line Number Program. */
+ struct symtab *symtab; /* The associated symbol table, if any. */
} *file_names;
-static void dwarf2_start_subfile (char *, char *, char *);
+static void dwarf2_start_subfile (char *, char *, char *, unsigned);
/* The start and end of the statement program following this
@@ -2754,6 +2758,15 @@
}
static struct symbol *new_symbol (struct die_info *, struct type *,
struct dwarf2_cu *);
@@ -6428,6 +6428,7 @@ add_file_name (struct line_header *lh,
unsigned int length)
static void
+free_cu_line_header (void *arg)
+{
+ struct dwarf2_cu *cu = arg;
+
+ free_line_header (cu->line_header);
+ cu->line_header = NULL;
+}
+
+static void
read_file_scope (struct die_info *die, struct dwarf2_cu *cu)
{
struct file_entry *fe;
+ char *dir = NULL;
struct objfile *objfile = cu->objfile;
@@ -2823,18 +2836,9 @@
/* Grow the array if necessary. */
if (lh->file_names_size == 0)
@@ -6450,6 +6451,10 @@ add_file_name (struct line_header *lh,
initialize_cu_func_list (cu);
- /* Process all dies in compilation unit. */
- if (die->child != NULL)
- {
- child_die = die->child;
- while (child_die && child_die->tag)
- {
- process_die (child_die, cu);
- child_die = sibling_die (child_die);
- }
- }
-
- /* Decode line number information if present. */
+ /* Decode line number information if present. We do this before
+ processing child DIEs, so that the line header table is available
+ for DW_AT_decl_file. */
attr = dwarf2_attr (die, DW_AT_stmt_list, cu);
if (attr)
{
@@ -2842,12 +2846,23 @@
line_header = dwarf_decode_line_header (line_offset, abfd, cu);
if (line_header)
{
- make_cleanup ((make_cleanup_ftype *) free_line_header,
- (void *) line_header);
+ cu->line_header = line_header;
+ make_cleanup (free_cu_line_header, cu);
dwarf_decode_lines (line_header, comp_dir, abfd, cu, NULL);
}
}
+ /* Process all dies in compilation unit. */
+ if (die->child != NULL)
+ {
+ child_die = die->child;
+ while (child_die && child_die->tag)
+ {
+ process_die (child_die, cu);
+ child_die = sibling_die (child_die);
+ }
+ }
+
/* Decode macro information, if present. Dwarf 2 macro information
refers to information in the line number info statement program
header, so we can only read it if we've read the header
@@ -6457,6 +6472,7 @@
fe->mod_time = mod_time;
fe->length = length;
fe->included_p = 0;
+
+ if (dir_index)
+ dir = lh->include_dirs[dir_index - 1];
+ dwarf2_start_subfile (name, dir, NULL, lh->num_file_names);
+ fe->symtab = NULL;
}
@@ -6668,7 +6673,7 @@ dwarf_decode_lines (struct line_header *
if (fe->dir_index)
dir = lh->include_dirs[fe->dir_index - 1];
@@ -6644,7 +6660,7 @@
CORE_ADDR baseaddr;
struct objfile *objfile = cu->objfile;
const int decode_for_pst_p = (pst != NULL);
- struct subfile *last_subfile = NULL;
+ struct subfile *last_subfile = NULL, *first_subfile = current_subfile;
- dwarf2_start_subfile (fe->name, dir, comp_dir);
+ dwarf2_start_subfile (fe->name, dir, comp_dir, file);
}
baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
/* Decode the table. */
@@ -6785,7 +6790,7 @@ dwarf_decode_lines (struct line_header *
if (!decode_for_pst_p)
{
last_subfile = current_subfile;
- dwarf2_start_subfile (fe->name, dir, comp_dir);
+ dwarf2_start_subfile (fe->name, dir, comp_dir, file);
}
}
break;
@@ -6889,7 +6894,8 @@ dwarf_decode_lines (struct line_header *
subfile's name. */
@@ -6869,6 +6885,35 @@
dwarf2_create_include_psymtab (include_name, pst, objfile);
}
}
+ else
+ {
+ /* Make sure a symtab is created for every file, even files
+ which contain only variables (i.e. no code with associated
+ line numbers). */
+
+ int i;
+ struct file_entry *fe;
+
+ for (i = 0; i < lh->num_file_names; i++)
+ {
+ char *dir = NULL;
+ fe = &lh->file_names[i];
+ if (fe->dir_index)
+ dir = lh->include_dirs[fe->dir_index - 1];
+ dwarf2_start_subfile (fe->name, dir, comp_dir);
+
+ /* Skip the main file; we don't need it, and it must be
+ allocated last, so that it will show up before the
+ non-primary symtabs in the objfile's symtab list. */
+ if (current_subfile == first_subfile)
+ continue;
+
+ if (current_subfile->symtab == NULL)
+ current_subfile->symtab = allocate_symtab (current_subfile->name,
+ cu->objfile);
+ fe->symtab = current_subfile->symtab;
+ }
+ }
}
static void
-dwarf2_start_subfile (char *filename, char *dirname, char *comp_dir)
+dwarf2_start_subfile (char *filename, char *dirname, char *comp_dir,
+ unsigned file_index)
{
char *fullname;
@@ -6908,7 +6914,7 @@ dwarf2_start_subfile (char *filename, ch
else
fullname = filename;
- start_subfile (fullname, comp_dir);
+ start_subfile_index (fullname, comp_dir, file_index);
if (fullname != filename)
xfree (fullname);
@@ -7017,6 +7023,13 @@ new_symbol (struct die_info *die, struct
/* Start a subfile for DWARF. FILENAME is the name of the file and
@@ -7024,6 +7069,23 @@
{
SYMBOL_LINE (sym) = DW_UNSND (attr);
}
+
+ attr = dwarf2_attr (die, DW_AT_decl_file, cu);
+ if (attr)
+ {
+ /* Do not yet search `objfile->symtabs' here as they still do not
+ have filled in their FILE.INDEX fields. */
+ SYMBOL_FILE_INDEX (sym) = DW_UNSND (attr);
+ int file_index = DW_UNSND (attr);
+ if (cu->line_header == NULL
+ || file_index > cu->line_header->num_file_names)
+ complaint (&symfile_complaints,
+ _("file index out of range"));
+ else
+ {
+ struct file_entry *fe;
+ fe = &cu->line_header->file_names[file_index - 1];
+ SYMBOL_SYMTAB (sym) = fe->symtab;
+ }
+ }
+
switch (die->tag)
{
case DW_TAG_label:
Index: gdb-6.6/gdb/symtab.c
===================================================================
--- gdb-6.6.orig/gdb/symtab.c 2007-01-20 13:59:25.000000000 +0100
+++ gdb-6.6/gdb/symtab.c 2007-01-20 13:59:48.000000000 +0100
@@ -1129,6 +1129,10 @@ lookup_symbol (const char *name, const s
RCS file: /cvs/src/src/gdb/symtab.c,v
retrieving revision 1.152
retrieving revision 1.153
diff -u -r1.152 -r1.153
--- src/gdb/symtab.c 2007/01/09 22:43:08 1.152
+++ src/gdb/symtab.c 2007/01/21 16:49:40 1.153
@@ -1133,6 +1133,10 @@
if (needtofreename)
xfree (demangled_name);
+ /* Override the returned symtab with optional symbol's specific one. */
+ /* Override the returned symtab with the symbol's specific one. */
+ if (returnval != NULL && symtab != NULL)
+ *symtab = SYMBOL_FILE_SYMTAB (returnval);
+ *symtab = SYMBOL_SYMTAB (returnval);
+
return returnval;
}
@@ -3235,7 +3239,7 @@ search_symbols (char *regexp, domain_enu
@@ -3008,7 +3012,11 @@
QUIT;
/* If it would match (logic taken from loop below)
- load the file and go on to the next one */
+ load the file and go on to the next one. We check the
+ filename here, but that's a bit bogus: we don't know
+ what file it really comes from until we have full
+ symtabs. The symbol might be in a header file included by
+ this psymtab. This only affects Insight. */
if (file_matches (ps->filename, files, nfiles)
&& ((regexp == NULL
|| re_exec (SYMBOL_NATURAL_NAME (*psym)) != 0)
@@ -3087,8 +3095,10 @@
b = BLOCKVECTOR_BLOCK (bv, i);
ALL_BLOCK_SYMBOLS (b, iter, sym)
{
+ struct symtab *real_symtab = SYMBOL_SYMTAB (sym);
QUIT;
- if (file_matches (s->filename, files, nfiles)
+ if (file_matches (SYMBOL_FILE_SYMTAB (sym)->filename, files, nfiles)
+
+ if (file_matches (real_symtab->filename, files, nfiles)
&& ((regexp == NULL
|| re_exec (SYMBOL_NATURAL_NAME (sym)) != 0)
&& ((kind == VARIABLES_DOMAIN && SYMBOL_CLASS (sym) != LOC_TYPEDEF
@@ -3248,7 +3252,7 @@ search_symbols (char *regexp, domain_enu
@@ -3101,7 +3111,7 @@
/* match */
psr = (struct symbol_search *) xmalloc (sizeof (struct symbol_search));
psr->block = i;
- psr->symtab = s;
+ psr->symtab = SYMBOL_FILE_SYMTAB (sym);
+ psr->symtab = real_symtab;
psr->symbol = sym;
psr->msymbol = NULL;
psr->next = NULL;
Index: gdb-6.6/gdb/symtab.h
===================================================================
--- gdb-6.6.orig/gdb/symtab.h 2007-01-20 06:43:00.000000000 +0100
+++ gdb-6.6/gdb/symtab.h 2007-01-20 13:59:48.000000000 +0100
@@ -623,6 +623,18 @@ struct symbol
RCS file: /cvs/src/src/gdb/symtab.h,v
retrieving revision 1.100
retrieving revision 1.101
diff -u -r1.100 -r1.101
--- src/gdb/symtab.h 2007/01/09 17:58:59 1.100
+++ src/gdb/symtab.h 2007/01/21 16:49:40 1.101
@@ -609,6 +609,10 @@
ENUM_BITFIELD(address_class) aclass : 6;
struct type *type;
+ /* File name it comes from. Use with `line' below.
+ FILE.INDEX is zero if the symbol's specific file is not known and in such
+ case we later default to the main file of the compilation unit.
+ FILE.SYMTAB gets resolved during end_symtab() and it is never NULL. */
+ /* The symbol table containing this symbol. This is the file
+ associated with LINE. */
+ struct symtab *symtab;
+
+ union
+ {
+ unsigned index;
+ struct symtab *symtab;
+ }
+ file;
+
/* Line number of definition. FIXME: Should we really make the assumption
that nobody will try to debug files longer than 64K lines? What about
machine generated programs? */
@@ -663,6 +675,8 @@ struct symbol
#define SYMBOL_DOMAIN(symbol) (symbol)->domain
/* Domain code. */
ENUM_BITFIELD(domain_enum_tag) domain : 6;
@@ -664,6 +668,7 @@
#define SYMBOL_CLASS(symbol) (symbol)->aclass
#define SYMBOL_TYPE(symbol) (symbol)->type
+#define SYMBOL_FILE_INDEX(symbol) (symbol)->file.index
+#define SYMBOL_FILE_SYMTAB(symbol) (symbol)->file.symtab
#define SYMBOL_LINE(symbol) (symbol)->line
+#define SYMBOL_SYMTAB(symbol) (symbol)->symtab
#define SYMBOL_BASEREG(symbol) (symbol)->aux_value.basereg
#define SYMBOL_OBJFILE(symbol) (symbol)->aux_value.objfile
#define SYMBOL_OPS(symbol) (symbol)->ops
/cvs/src/src/gdb/testsuite/gdb.base/included.c,v --> standard output
revision 1.1
--- src/gdb/testsuite/gdb.base/included.c
+++ src/gdb/testsuite/gdb.base/included.c 2007-12-21 21:10:02.262608000 +0000
@@ -0,0 +1,26 @@
+/* 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. */
+
+#include "included.h"
+
+int
+main()
+{
+ return 0;
+}
/cvs/src/src/gdb/testsuite/gdb.base/included.exp,v --> standard output
revision 1.1
--- src/gdb/testsuite/gdb.base/included.exp
+++ src/gdb/testsuite/gdb.base/included.exp 2007-12-21 21:10:02.521938000 +0000
@@ -0,0 +1,46 @@
+# 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.
+
+set testfile "included"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+ untested included.exp
+ return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+gdb_test "set listsize 1" ""
+
+gdb_test "list main" ".*"
+get_debug_format
+set non_dwarf [expr ! [test_debug_format "DWARF 2"]]
+
+# We should be able to find the source file containing the definition,
+# even though it was an included header.
+if { $non_dwarf } { setup_xfail *-*-* }
+gdb_test "list integer" "int integer;"
+
+gdb_test "ptype integer" "type = int"
+
+# We should report that integer comes from the header file.
+if { $non_dwarf } { setup_xfail *-*-* }
+gdb_test "info variables integer" "\r\nFile \[^\r\n\]*/${subdir}/${testfile}.h:\r\nint integer;"
/cvs/src/src/gdb/testsuite/gdb.base/included.h,v --> standard output
revision 1.1
--- src/gdb/testsuite/gdb.base/included.h
+++ src/gdb/testsuite/gdb.base/included.h 2007-12-21 21:10:02.732382000 +0000
@@ -0,0 +1,20 @@
+/* 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. */
+
+int integer;

View File

@ -1,12 +1,13 @@
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=109921
It is duplicite to its upstream variant at:
gdb-6.5-bz109921-DW_AT_decl_file-fix.patch
2007-01-09 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.dwarf2/dw2-included.exp, gdb.dwarf2/dw2-included.c,
gdb.dwarf2/dw2-included.h: New files.
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.dwarf2/dw2-included.c 2 Jan 2007 00:20:27 -0000
@@ -0,0 +1,26 @@

View File

@ -1,7 +1,7 @@
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=185337
currently for trivia nonthreaded helloworld with no debug info up to -ggdb2 you
currently for trivial nonthreaded helloworld with no debug info up to -ggdb2 you
will get:
(gdb) p errno
[some error]
@ -17,17 +17,155 @@ Attached suggestion patch how to deal with the most common "errno" symbol
for the most common under-ggdb3 compiled programs.
2006-08-25 Jan Kratochvil <jan.kratochvil@redhat.com>
* target.c (target_translate_tls_address): Provided warnings for TLS
`errno' on non-TLS targets.
2007-11-03 Jan Kratochvil <jan.kratochvil@redhat.com>
* ./gdb/dwarf2read.c (read_partial_die, dwarf2_linkage_name): Prefer
DW_AT_MIPS_linkage_name over DW_AT_name now only for non-C.
glibc-debuginfo-2.7-2.x86_64: /usr/lib/debug/lib64/libc.so.6.debug:
<81a2> DW_AT_name : (indirect string, offset: 0x280e): __errno_location
<81a8> DW_AT_MIPS_linkage_name: (indirect string, offset: 0x2808): *__GI___errno_location
--- ./gdb/dwarf2read.c 25 Oct 2007 20:54:27 -0000 1.236
+++ ./gdb/dwarf2read.c 3 Nov 2007 21:03:43 -0000
@@ -5550,8 +5550,8 @@ read_partial_die (struct partial_die_inf
{
case DW_AT_name:
- /* Prefer DW_AT_MIPS_linkage_name over DW_AT_name. */
- if (part_die->name == NULL)
+ /* Prefer DW_AT_MIPS_linkage_name over DW_AT_name for non-C. */
+ if (cu->language == language_c || part_die->name == NULL)
part_die->name = DW_STRING (&attr);
break;
case DW_AT_comp_dir:
@@ -5559,7 +5559,9 @@ read_partial_die (struct partial_die_inf
part_die->dirname = DW_STRING (&attr);
break;
case DW_AT_MIPS_linkage_name:
- part_die->name = DW_STRING (&attr);
+ /* Prefer DW_AT_MIPS_linkage_name over DW_AT_name for non-C. */
+ if (cu->language != language_c || part_die->name == NULL)
+ part_die->name = DW_STRING (&attr);
break;
case DW_AT_low_pc:
has_low_pc_attr = 1;
@@ -7871,9 +7873,13 @@ dwarf2_linkage_name (struct die_info *di
{
struct attribute *attr;
- attr = dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu);
- if (attr && DW_STRING (attr))
- return DW_STRING (attr);
+ /* Prefer DW_AT_MIPS_linkage_name over DW_AT_name for non-C. */
+ if (cu->language != language_c)
+ {
+ attr = dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu);
+ if (attr && DW_STRING (attr))
+ return DW_STRING (attr);
+ }
attr = dwarf2_attr (die, DW_AT_name, cu);
if (attr && DW_STRING (attr))
return DW_STRING (attr);
Index: gdb-6.6/gdb/target.c
===================================================================
--- gdb-6.6.orig/gdb/target.c 2007-01-17 01:25:31.000000000 +0100
+++ gdb-6.6/gdb/target.c 2007-01-20 06:31:36.000000000 +0100
@@ -898,7 +898,18 @@
diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.6-orig/gdb/gdbtypes.c gdb-6.6/gdb/gdbtypes.c
--- gdb-6.6-orig/gdb/gdbtypes.c 2006-08-22 21:45:12.000000000 +0200
+++ gdb-6.6/gdb/gdbtypes.c 2007-11-08 22:23:37.000000000 +0100
@@ -49,6 +49,7 @@ struct type *builtin_type_char;
struct type *builtin_type_true_char;
struct type *builtin_type_short;
struct type *builtin_type_int;
+struct type *builtin_type_int_ptr;
struct type *builtin_type_long;
struct type *builtin_type_long_long;
struct type *builtin_type_signed_char;
@@ -3330,6 +3331,7 @@ build_gdbtypes (void)
init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
0,
"int", (struct objfile *) NULL);
+ builtin_type_int_ptr = make_pointer_type (builtin_type_int, NULL);
builtin_type_unsigned_int =
init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
TYPE_FLAG_UNSIGNED,
diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.6-orig/gdb/gdbtypes.h gdb-6.6/gdb/gdbtypes.h
--- gdb-6.6-orig/gdb/gdbtypes.h 2007-11-08 22:07:59.000000000 +0100
+++ gdb-6.6/gdb/gdbtypes.h 2007-11-08 22:24:49.000000000 +0100
@@ -1024,6 +1024,7 @@ extern struct type *builtin_type_void;
extern struct type *builtin_type_char;
extern struct type *builtin_type_short;
extern struct type *builtin_type_int;
+extern struct type *builtin_type_int_ptr;
extern struct type *builtin_type_long;
extern struct type *builtin_type_signed_char;
extern struct type *builtin_type_unsigned_char;
diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.6-orig/gdb/parse.c gdb-6.6/gdb/parse.c
--- gdb-6.6-orig/gdb/parse.c 2006-11-22 01:05:37.000000000 +0100
+++ gdb-6.6/gdb/parse.c 2007-11-08 22:22:42.000000000 +0100
@@ -386,6 +386,7 @@ write_exp_bitstring (struct stoken str)
the initial rationale is gone. */
static struct type *msym_text_symbol_type;
+static struct type *msym_text_symbol_errno_location_type;
static struct type *msym_data_symbol_type;
static struct type *msym_unknown_symbol_type;
static struct type *msym_tls_symbol_type;
@@ -431,7 +432,11 @@ write_exp_msymbol (struct minimal_symbol
case mst_text:
case mst_file_text:
case mst_solib_trampoline:
- write_exp_elt_type (msym_text_symbol_type);
+ if (msym_text_symbol_errno_location_type != NULL
+ && strcmp (SYMBOL_LINKAGE_NAME (msymbol), "__errno_location") == 0)
+ write_exp_elt_type (msym_text_symbol_errno_location_type);
+ else
+ write_exp_elt_type (msym_text_symbol_type);
break;
case mst_data:
@@ -1367,6 +1372,10 @@ build_parse (void)
msym_text_symbol_type =
init_type (TYPE_CODE_FUNC, 1, 0, "<text variable, no debug info>", NULL);
TYPE_TARGET_TYPE (msym_text_symbol_type) = builtin_type_int;
+ msym_text_symbol_errno_location_type =
+ init_type (TYPE_CODE_FUNC,
+ 1, 0, "<text variable for __errno_location, no debug info>", NULL);
+ TYPE_TARGET_TYPE (msym_text_symbol_errno_location_type ) = builtin_type_int_ptr;
msym_data_symbol_type =
init_type (TYPE_CODE_INT, TARGET_INT_BIT / HOST_CHAR_BIT, 0,
"<data variable, no debug info>", NULL);
diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.6-orig/gdb/target.c gdb-6.6/gdb/target.c
--- gdb-6.6-orig/gdb/target.c 2007-11-08 22:07:59.000000000 +0100
+++ gdb-6.6/gdb/target.c 2007-11-08 22:35:34.000000000 +0100
@@ -817,6 +817,25 @@ pop_target (void)
internal_error (__FILE__, __LINE__, _("failed internal consistency check"));
}
+static int
+resolve_errno (void *arg)
+{
+ CORE_ADDR *arg_addr = arg;
+ struct expression *expr;
+ struct cleanup *old_chain = 0;
+ struct value *val;
+
+ expr = parse_expression ("__errno_location()");
+ old_chain = make_cleanup (free_current_contents, &expr);
+ val = evaluate_expression (expr);
+ *arg_addr = value_as_address (val);
+ release_value (val);
+ value_free (val);
+ do_cleanups (old_chain);
+
+ return 1;
+}
+
/* Using the objfile specified in BATON, find the address for the
current thread's thread-local storage with offset OFFSET. */
CORE_ADDR
@@ -904,7 +923,28 @@ target_translate_tls_address (struct obj
/* It wouldn't be wrong here to try a gdbarch method, too; finding
TLS is an ABI-specific thing. But we don't do that yet. */
else
@ -38,12 +176,125 @@ Index: gdb-6.6/gdb/target.c
+ msymbol = lookup_minimal_symbol ("errno", NULL, NULL);
+ if (msymbol != NULL
+ && SYMBOL_VALUE_ADDRESS (msymbol) == offset
+ && SYMBOL_BFD_SECTION (msymbol)->owner == objfile->obfd)
+ error (_("TLS symbol `errno' not resolved for non-TLS program."
+ " You should use symbol \"(*__errno_location ())\" or"
+ " compile the program with `gcc -ggdb3' or `gcc -pthread'."));
+ error (_("Cannot find thread-local variables on this target"));
+ && (SYMBOL_BFD_SECTION (msymbol)->owner == objfile->obfd
+ || (objfile->separate_debug_objfile != NULL
+ && SYMBOL_BFD_SECTION (msymbol)->owner
+ == objfile->separate_debug_objfile->obfd)
+ || (objfile->separate_debug_objfile_backlink != NULL
+ && SYMBOL_BFD_SECTION (msymbol)->owner
+ == objfile->separate_debug_objfile_backlink->obfd)))
+ {
+ if (!catch_errors (resolve_errno, (void *) &addr, "",
+ RETURN_MASK_ALL))
+ error (_("TLS symbol `errno' not resolved for non-TLS program."
+ " You should compile the program with `gcc -pthread'."));
+ }
+ else
+ error (_("Cannot find thread-local variables on this target"));
+ }
return addr;
}
diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1/gdb/testsuite/gdb.dwarf2/dw2-errno.c gdb-6.7.1-patched/gdb/testsuite/gdb.dwarf2/dw2-errno.c
--- gdb-6.7.1/gdb/testsuite/gdb.dwarf2/dw2-errno.c 2007-11-04 01:43:41.000000000 +0100
+++ gdb-6.7.1-patched/gdb/testsuite/gdb.dwarf2/dw2-errno.c 2007-11-03 23:29:02.000000000 +0100
@@ -0,0 +1,28 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2005, 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 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ Please email any bugs, comments, and/or additions to this file to:
+ bug-gdb@prep.ai.mit.edu */
+
+#include <errno.h>
+
+int main()
+{
+ errno = 42;
+
+ return 0; /* breakpoint */
+}
diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7.1/gdb/testsuite/gdb.dwarf2/dw2-errno.exp gdb-6.7.1-patched/gdb/testsuite/gdb.dwarf2/dw2-errno.exp
--- gdb-6.7.1/gdb/testsuite/gdb.dwarf2/dw2-errno.exp 2007-11-04 01:43:39.000000000 +0100
+++ gdb-6.7.1-patched/gdb/testsuite/gdb.dwarf2/dw2-errno.exp 2007-11-04 01:41:46.000000000 +0100
@@ -0,0 +1,67 @@
+# 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 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 $tracelevel then {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+set testfile dw2-errno
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+
+proc prep {} {
+ global srcdir subdir binfile
+ gdb_exit
+ gdb_start
+ gdb_reinitialize_dir $srcdir/$subdir
+ gdb_load ${binfile}
+
+ runto_main
+
+ gdb_breakpoint [gdb_get_line_number "breakpoint"]
+ gdb_continue_to_breakpoint "breakpoint"
+}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "additional_flags=-g2"] != "" } {
+ untested "Couldn't compile test program"
+ return -1
+}
+prep
+gdb_test "print errno" ".* = 42" "errno with macros=N threads=N"
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "additional_flags=-g3"] != "" } {
+ untested "Couldn't compile test program"
+ return -1
+}
+prep
+gdb_test "print errno" ".* = 42" "errno with macros=Y threads=N"
+
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "additional_flags=-g2"] != "" } {
+ return -1
+}
+prep
+gdb_test "print errno" ".* = 42" "errno with macros=N threads=Y"
+
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "additional_flags=-g3"] != "" } {
+ return -1
+}
+prep
+gdb_test "print errno" ".* = 42" "errno with macros=Y threads=Y"
+
+# TODO: Test the error on resolving ERRNO with only libc loaded.
+# Just how to find the current libc filename?

View File

@ -1,12 +1,15 @@
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=215816
2007-01-03 Jan Kratochvil <jan.kratochvil@redhat.com>
Daniel Jacobowitz <dan@codesourcery.com>
* gdb.base/readline.exp: Set $TERM. Test arrow keys in
secondary prompts.
2007-07-01 Nick Roberts <nickrob@snap.net.nz>
Daniel Jacobowitz <dan@codesourcery.com>
* gdb.base/annota3.exp: Test for if construct.
--- ./gdb/testsuite/gdb.base/readline.exp 8 Jun 2003 13:14:05 -0000 1.2
+++ ./gdb/testsuite/gdb.base/readline.exp 3 Jan 2007 21:22:47 -0000
@ -50,3 +53,41 @@ https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=215816
# Now repeat the first test with a history file that fills the entire
# history list.
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/annota3.exp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- src/gdb/testsuite/gdb.base/annota3.exp 2007/01/09 17:59:09 1.12
+++ src/gdb/testsuite/gdb.base/annota3.exp 2007/07/01 22:37:52 1.13
@@ -99,7 +99,29 @@
"set annotate 3"
}
-
+#
+# if construct:
+#
+send_gdb "if 1\n"
+gdb_expect {
+ -re "^if 1\r\n\r\n\032\032post-prompt\r\n\r\n\032\032pre-commands\r\n >\r\n\032\032commands\r\n$" {
+ pass "start if construct"
+ }
+ -re ".*\032\032commands\r\n" {
+ fail "start if construct"
+ }
+ timeout { fail "start if construct (timeout)" }
+}
+send_gdb "end\n"
+gdb_expect {
+ -re "^end\r\n\r\n\032\032post-commands\r\n$gdb_prompt$" {
+ pass "end if construct"
+ }
+ -re ".*$gdb_prompt$" {
+ fail "end if construct"
+ }
+ timeout { fail "end if construct (timeout)" }
+}
#
# info break:
#

View File

@ -1,6 +1,5 @@
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=215816
2007-01-03 Jan Kratochvil <jan.kratochvil@redhat.com>
Daniel Jacobowitz <dan@codesourcery.com>
@ -11,6 +10,13 @@ https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=215816
New.
(gdb_readline_wrapper): Rewrite to use asynchronous readline.
2007-07-01 Daniel Jacobowitz <dan@codesourcery.com>
* top.c (gdb_readline_wrapper_line): Call rl_callback_handler_remove.
(struct gdb_readline_wrapper_cleanup): Remove prompt_orig.
(gdb_readline_wrapper_cleanup): Do not reset the prompt.
(gdb_readline_wrapper): Do not save the prompt. Pass our prompt
to display_gdb_prompt.
--- ./gdb/Makefile.in 3 Jan 2007 18:05:43 -0000 1.864
+++ ./gdb/Makefile.in 3 Jan 2007 21:22:46 -0000
@ -163,3 +169,52 @@ https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=215816
}
===================================================================
RCS file: /cvs/src/src/gdb/top.c,v
retrieving revision 1.120
retrieving revision 1.121
diff -u -r1.120 -r1.121
--- src/gdb/top.c 2007/03/29 18:55:01 1.120
+++ src/gdb/top.c 2007/07/01 22:37:52 1.121
@@ -751,12 +751,16 @@
/* Prevent operate-and-get-next from acting too early. */
saved_after_char_processing_hook = after_char_processing_hook;
after_char_processing_hook = NULL;
+
+ /* Prevent parts of the prompt from being redisplayed if annotations
+ are enabled, and readline's state getting out of sync. */
+ if (async_command_editing_p)
+ rl_callback_handler_remove ();
}
struct gdb_readline_wrapper_cleanup
{
void (*handler_orig) (char *);
- char *prompt_orig;
int already_prompted_orig;
};
@@ -766,7 +770,6 @@
struct gdb_readline_wrapper_cleanup *cleanup = arg;
rl_already_prompted = cleanup->already_prompted_orig;
- PROMPT (0) = cleanup->prompt_orig;
gdb_assert (input_handler == gdb_readline_wrapper_line);
input_handler = cleanup->handler_orig;
@@ -790,14 +793,12 @@
cleanup->handler_orig = input_handler;
input_handler = gdb_readline_wrapper_line;
- cleanup->prompt_orig = get_prompt ();
- PROMPT (0) = prompt;
cleanup->already_prompted_orig = rl_already_prompted;
back_to = make_cleanup (gdb_readline_wrapper_cleanup, cleanup);
/* Display our prompt and prevent double prompt display. */
- display_gdb_prompt (NULL);
+ display_gdb_prompt (prompt);
rl_already_prompted = 1;
if (after_char_processing_hook)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,36 @@
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=426613
A very minimal backport of the upstream:
http://sourceware.org/ml/gdb-patches/2007-03/msg00307.html
`continue' of a PIE ppc32 program on ppc64 GDB fails.
diff -u -rup gdb-6.6-orig/gdb/solib-svr4.c gdb-6.6/gdb/solib-svr4.c
--- gdb-6.6-orig/gdb/solib-svr4.c 2007-12-26 18:46:17.000000000 -0500
+++ gdb-6.6/gdb/solib-svr4.c 2007-12-27 16:38:59.000000000 -0500
@@ -130,9 +130,9 @@ LM_ADDR_FROM_LINK_MAP (struct so_list *s
{
struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
- return (CORE_ADDR) extract_signed_integer (so->lm_info->lm
- + lmo->l_addr_offset,
- lmo->l_addr_size);
+ return (CORE_ADDR) extract_unsigned_integer (so->lm_info->lm
+ + lmo->l_addr_offset,
+ lmo->l_addr_size);
}
static int
@@ -150,9 +150,9 @@ LM_DYNAMIC_FROM_LINK_MAP (struct so_list
gdb_assert (lmo->l_ld_size != 0);
- return (CORE_ADDR) extract_signed_integer (so->lm_info->lm
- + lmo->l_ld_offset,
- lmo->l_ld_size);
+ return (CORE_ADDR) extract_unsigned_integer (so->lm_info->lm
+ + lmo->l_ld_offset,
+ lmo->l_ld_size);
}
static CORE_ADDR

422
gdb-6.6-cu-ranges.patch Normal file
View File

@ -0,0 +1,422 @@
2007-10-09 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf2read.c (dwarf2_get_pc_bounds): Moved the `DW_AT_ranges' parsing
code with its variables OBJFILE, CU_HEADER and OBFD into ...
(dwarf2_ranges_read): ... a new function.
(read_partial_die): Implemented the parsing of `DW_AT_ranges'.
2007-10-09 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.dwarf2/dw2-ranges.S, gdb.dwarf2/dw2-ranges.exp,
gdb.dwarf2/dw2-ranges.lds: New files.
--- ./gdb/dwarf2read.c 26 Sep 2007 13:59:54 -0000 1.232
+++ ./gdb/dwarf2read.c 9 Oct 2007 15:03:09 -0000
@@ -3075,6 +3075,124 @@ read_lexical_block_scope (struct die_inf
local_symbols = new->locals;
}
+/* Get low and high pc attributes from DW_AT_ranges attribute value OFFSET.
+ Return 1 if the attributes are present and valid, otherwise, return 0. */
+
+static int
+dwarf2_ranges_read (unsigned offset, CORE_ADDR *low_return,
+ CORE_ADDR *high_return, struct dwarf2_cu *cu)
+{
+ struct objfile *objfile = cu->objfile;
+ struct comp_unit_head *cu_header = &cu->header;
+ bfd *obfd = objfile->obfd;
+ unsigned int addr_size = cu_header->addr_size;
+ CORE_ADDR mask = ~(~(CORE_ADDR)1 << (addr_size * 8 - 1));
+ /* Base address selection entry. */
+ CORE_ADDR base;
+ int found_base;
+ unsigned int dummy;
+ gdb_byte *buffer;
+ CORE_ADDR marker;
+ int low_set;
+ CORE_ADDR low = 0;
+ CORE_ADDR high = 0;
+
+ found_base = cu_header->base_known;
+ base = cu_header->base_address;
+
+ if (offset >= dwarf2_per_objfile->ranges_size)
+ {
+ complaint (&symfile_complaints,
+ _("Offset %d out of bounds for DW_AT_ranges attribute"),
+ offset);
+ return 0;
+ }
+ buffer = dwarf2_per_objfile->ranges_buffer + offset;
+
+ /* Read in the largest possible address. */
+ marker = read_address (obfd, buffer, cu, &dummy);
+ if ((marker & mask) == mask)
+ {
+ /* If we found the largest possible address, then
+ read the base address. */
+ base = read_address (obfd, buffer + addr_size, cu, &dummy);
+ buffer += 2 * addr_size;
+ offset += 2 * addr_size;
+ found_base = 1;
+ }
+
+ low_set = 0;
+
+ while (1)
+ {
+ CORE_ADDR range_beginning, range_end;
+
+ range_beginning = read_address (obfd, buffer, cu, &dummy);
+ buffer += addr_size;
+ range_end = read_address (obfd, buffer, cu, &dummy);
+ buffer += addr_size;
+ offset += 2 * addr_size;
+
+ /* An end of list marker is a pair of zero addresses. */
+ if (range_beginning == 0 && range_end == 0)
+ /* Found the end of list entry. */
+ break;
+
+ /* Each base address selection entry is a pair of 2 values.
+ The first is the largest possible address, the second is
+ the base address. Check for a base address here. */
+ if ((range_beginning & mask) == mask)
+ {
+ /* If we found the largest possible address, then
+ read the base address. */
+ base = read_address (obfd, buffer + addr_size, cu, &dummy);
+ found_base = 1;
+ continue;
+ }
+
+ if (!found_base)
+ {
+ /* We have no valid base address for the ranges
+ data. */
+ complaint (&symfile_complaints,
+ _("Invalid .debug_ranges data (no base address)"));
+ return 0;
+ }
+
+ range_beginning += base;
+ range_end += base;
+
+ /* FIXME: This is recording everything as a low-high
+ segment of consecutive addresses. We should have a
+ data structure for discontiguous block ranges
+ instead. */
+ if (! low_set)
+ {
+ low = range_beginning;
+ high = range_end;
+ low_set = 1;
+ }
+ else
+ {
+ if (range_beginning < low)
+ low = range_beginning;
+ if (range_end > high)
+ high = range_end;
+ }
+ }
+
+ if (! low_set)
+ /* If the first entry is an end-of-list marker, the range
+ describes an empty scope, i.e. no instructions. */
+ return 0;
+
+ if (low_return)
+ *low_return = low;
+ if (high_return)
+ *high_return = high;
+ return 1;
+}
+
/* Get low and high pc attributes from a die. Return 1 if the attributes
are present and valid, otherwise, return 0. Return -1 if the range is
discontinuous, i.e. derived from DW_AT_ranges information. */
@@ -3082,10 +3200,7 @@ static int
dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
CORE_ADDR *highpc, struct dwarf2_cu *cu)
{
- struct objfile *objfile = cu->objfile;
- struct comp_unit_head *cu_header = &cu->header;
struct attribute *attr;
- bfd *obfd = objfile->obfd;
CORE_ADDR low = 0;
CORE_ADDR high = 0;
int ret = 0;
@@ -3109,108 +3224,11 @@ dwarf2_get_pc_bounds (struct die_info *d
attr = dwarf2_attr (die, DW_AT_ranges, cu);
if (attr != NULL)
{
- unsigned int addr_size = cu_header->addr_size;
- CORE_ADDR mask = ~(~(CORE_ADDR)1 << (addr_size * 8 - 1));
/* Value of the DW_AT_ranges attribute is the offset in the
.debug_ranges section. */
- unsigned int offset = DW_UNSND (attr);
- /* Base address selection entry. */
- CORE_ADDR base;
- int found_base;
- unsigned int dummy;
- gdb_byte *buffer;
- CORE_ADDR marker;
- int low_set;
-
- found_base = cu_header->base_known;
- base = cu_header->base_address;
-
- if (offset >= dwarf2_per_objfile->ranges_size)
- {
- complaint (&symfile_complaints,
- _("Offset %d out of bounds for DW_AT_ranges attribute"),
- offset);
- return 0;
- }
- buffer = dwarf2_per_objfile->ranges_buffer + offset;
-
- /* Read in the largest possible address. */
- marker = read_address (obfd, buffer, cu, &dummy);
- if ((marker & mask) == mask)
- {
- /* If we found the largest possible address, then
- read the base address. */
- base = read_address (obfd, buffer + addr_size, cu, &dummy);
- buffer += 2 * addr_size;
- offset += 2 * addr_size;
- found_base = 1;
- }
-
- low_set = 0;
-
- while (1)
- {
- CORE_ADDR range_beginning, range_end;
-
- range_beginning = read_address (obfd, buffer, cu, &dummy);
- buffer += addr_size;
- range_end = read_address (obfd, buffer, cu, &dummy);
- buffer += addr_size;
- offset += 2 * addr_size;
-
- /* An end of list marker is a pair of zero addresses. */
- if (range_beginning == 0 && range_end == 0)
- /* Found the end of list entry. */
- break;
-
- /* Each base address selection entry is a pair of 2 values.
- The first is the largest possible address, the second is
- the base address. Check for a base address here. */
- if ((range_beginning & mask) == mask)
- {
- /* If we found the largest possible address, then
- read the base address. */
- base = read_address (obfd, buffer + addr_size, cu, &dummy);
- found_base = 1;
- continue;
- }
-
- if (!found_base)
- {
- /* We have no valid base address for the ranges
- data. */
- complaint (&symfile_complaints,
- _("Invalid .debug_ranges data (no base address)"));
- return 0;
- }
-
- range_beginning += base;
- range_end += base;
-
- /* FIXME: This is recording everything as a low-high
- segment of consecutive addresses. We should have a
- data structure for discontiguous block ranges
- instead. */
- if (! low_set)
- {
- low = range_beginning;
- high = range_end;
- low_set = 1;
- }
- else
- {
- if (range_beginning < low)
- low = range_beginning;
- if (range_end > high)
- high = range_end;
- }
- }
-
- if (! low_set)
- /* If the first entry is an end-of-list marker, the range
- describes an empty scope, i.e. no instructions. */
+ if (!dwarf2_ranges_read (DW_UNSND (attr), &low, &high, cu))
return 0;
-
+ /* Found discontinuous range of addresses. */
ret = -1;
}
}
@@ -5571,6 +5589,11 @@ read_partial_die (struct partial_die_inf
has_high_pc_attr = 1;
part_die->highpc = DW_ADDR (&attr);
break;
+ case DW_AT_ranges:
+ if (dwarf2_ranges_read (DW_UNSND (&attr), &part_die->lowpc,
+ &part_die->highpc, cu))
+ has_low_pc_attr = has_high_pc_attr = 1;
+ break;
case DW_AT_location:
/* Support the .debug_loc offsets */
if (attr_form_is_block (&attr))
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.dwarf2/dw2-ranges.S 9 Oct 2007 15:03:10 -0000
@@ -0,0 +1,33 @@
+/*
+ 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 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/>.
+ */
+
+ .text
+
+ .section .text._start, "ax", @progbits
+ .globl _start
+ .func _start
+_start: call func
+ .endfunc
+ .size _start, . - _start
+
+ .section .text.func, "ax", @progbits
+ .globl func
+ .func func
+func: int3
+ nop
+ .endfunc
+ .size func, . - func
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.dwarf2/dw2-ranges.exp 9 Oct 2007 15:03:10 -0000
@@ -0,0 +1,82 @@
+# 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 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 DW_TAG_compile_unit with no children and with neither DW_AT_low_pc nor
+# DW_AT_high_pc but with DW_AT_ranges instead. We created the hole there for
+# DW_AT_ranges by the linker script.
+
+# 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*]} {
+ verbose "Skipping i386/amd64 DW_AT_ranges test."
+ return 0
+}
+if { ![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"] } then {
+ verbose "Skipping i386/amd64 DW_AT_ranges test."
+ return 0
+}
+
+set testfile "dw2-ranges"
+set srcfile ${testfile}.S
+set ldsfile ${testfile}.lds
+set binfile ${objdir}/${subdir}/${testfile}
+
+# Avoid `-lm' from `lib/ada.exp' as it would fail with out `-nostdlib'.
+# Provide BOARD for SET_BOARD_INFO.
+set board [target_info name]
+set_board_info mathlib ""
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "additional_flags=-Wl,--script=${srcdir}/${subdir}/${ldsfile} -nostdlib"]] != "" } {
+ return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+# Former wrong output:
+# Program received signal SIGTRAP, Trace/breakpoint trap.
+# 0x000000000000002b in func ()
+# (gdb) bt
+# #0 0x000000000000002b in func ()
+# #1 0x0000000000000029 in _start ()
+# (gdb) _
+# Correct output:
+# Program received signal SIGTRAP, Trace/breakpoint trap.
+# func () at dw2-ranges.S:14
+# 14 nop
+# Current language: auto; currently asm
+# (gdb) bt
+# #0 func () at dw2-ranges.S:14
+# #1 0x0000000000000029 in _start () at dw2-ranges.S:6
+# (gdb) _
+# The entry #1 is missing on i386.
+# "#0 +func \\(\\) at .*dw2-ranges.S:\[0-9\]+\r\n#1 .*in _start \\(\\) at .*dw2-ranges.S:\[0-9\]+"
+
+gdb_run_cmd
+set test "run"
+gdb_test_multiple "" "$test" {
+ -re "Program received signal SIGTRAP,.*$gdb_prompt $" {
+ pass $test
+ }
+}
+
+gdb_test "backtrace" "#0 +func \\(\\) at .*dw2-ranges.S:\[0-9\]+"
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.dwarf2/dw2-ranges.lds 9 Oct 2007 15:03:10 -0000
@@ -0,0 +1,25 @@
+/*
+ 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 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/>.
+ */
+
+SECTIONS
+{
+ .text._start : { *(.text._start) }
+ /* Create the hole. */
+ . = . + 1;
+ .text.func : { *(.text.func) }
+}
+ENTRY(_start)

View File

@ -0,0 +1,354 @@
2007-10-14 Jan Kratochvil <jan.kratochvil@redhat.com>
Handle multiple different PIDs for the DR registers.
* i386-nat.c: Include "inferior.h".
(struct dr_mirror_status, dr_mirror_active, dr_mirror_fetch): New.
(dr_mirror, dr_status_mirror, dr_control_mirror, dr_ref_count):
Redefined using DR_MIRROR_ACTIVE.
(i386_cleanup_dregs): Clear the DR_MIRROR_ACTIVE content instead.
(i386_show_dr, i386_insert_aligned_watchpoint)
(i386_remove_aligned_watchpoint, i386_stopped_data_address)
(i386_stopped_by_hwbp): Call DR_MIRROR_FETCH.
* Makefile.in (i386-nat.o): Update dependencies.
2007-10-14 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/watchpoint-fork.exp, gdb.base/watchpoint-fork.c: New files.
[ Backported for GDB-6.6 (only removed the new file inclusion). ]
http://sources.redhat.com/ml/gdb-patches/2007-07/msg00034.html
2007-07-02 Daniel Jacobowitz <dan@codesourcery.com>
* breakpoint.c (reattach_breakpoints): Do not use remove_breakpoint.
Call insert_bp_location.
[ In `gdb-6.6-upstream.patch'. ]
2007-09-16 Daniel Jacobowitz <dan@codesourcery.com>
Jeff Johnston <jjohnstn@redhat.com>
* gdb.texinfo (Setting Watchpoints): Adjust warning text about
multi-threaded watchpoints.
2007-12-15 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.texinfo (Setting Watchpoints): New paragraph on the software
watchpoints safety wrt `set scheduler-locking'.
--- ./gdb/i386-nat.c 23 Aug 2007 18:08:34 -0000 1.16
+++ ./gdb/i386-nat.c 14 Oct 2007 15:00:31 -0000
@@ -165,11 +166,22 @@
/* Mirror the inferior's DRi registers. We keep the status and
control registers separated because they don't hold addresses. */
-static CORE_ADDR dr_mirror[DR_NADDR];
-static unsigned dr_status_mirror, dr_control_mirror;
+struct dr_mirror_status
+ {
+ /* Cyclic list. */
+ struct dr_mirror_status *next;
+ long lwp;
+ CORE_ADDR addr[DR_NADDR];
+ unsigned status, control;
+ int ref_count[DR_NADDR];
+ };
+struct dr_mirror_status *dr_mirror_active;
+#define dr_mirror (dr_mirror_active->addr)
+#define dr_status_mirror (dr_mirror_active->status)
+#define dr_control_mirror (dr_mirror_active->control)
/* Reference counts for each debug register. */
-static int dr_ref_count[DR_NADDR];
+#define dr_ref_count (dr_mirror_active->ref_count)
/* Whether or not to print the mirrored debug registers. */
static int maint_show_dr;
@@ -218,15 +230,19 @@ static int i386_handle_nonaligned_watchp
void
i386_cleanup_dregs (void)
{
- int i;
+ struct dr_mirror_status *first = dr_mirror_active;
- ALL_DEBUG_REGISTERS(i)
+ if (first == NULL)
+ return;
+ do
{
- dr_mirror[i] = 0;
- dr_ref_count[i] = 0;
+ struct dr_mirror_status *next = dr_mirror_active->next;
+
+ xfree (dr_mirror_active);
+ dr_mirror_active = next;
}
- dr_control_mirror = 0;
- dr_status_mirror = 0;
+ while (dr_mirror_active != first);
+ dr_mirror_active = NULL;
}
/* Reset all debug registers at each new startup to avoid missing
@@ -238,6 +254,40 @@ child_post_startup_inferior (ptid_t ptid
i386_cleanup_dregs ();
}
+static void
+dr_mirror_fetch (void)
+{
+ long lwp;
+ int i;
+
+ lwp = ptid_get_lwp (inferior_ptid);
+ if (lwp == 0)
+ lwp = ptid_get_pid (inferior_ptid);
+
+ if (dr_mirror_active == NULL)
+ {
+ dr_mirror_active = xzalloc (sizeof *dr_mirror_active);
+ dr_mirror_active->next = dr_mirror_active;
+ }
+ else
+ {
+ struct dr_mirror_status *first = dr_mirror_active;
+ do
+ {
+ if (dr_mirror_active->lwp == lwp)
+ return;
+ dr_mirror_active = dr_mirror_active->next;
+ }
+ while (dr_mirror_active != first);
+ dr_mirror_active = xzalloc (sizeof *dr_mirror_active);
+ dr_mirror_active->next = first->next;
+ first->next = dr_mirror_active;
+ }
+ dr_mirror_active->lwp = lwp;
+
+ /* All the registers left 0. */
+}
+
/* Print the values of the mirrored debug registers. This is called
when maint_show_dr is non-zero. To set that up, type "maint
show-debug-regs" at GDB's prompt. */
@@ -248,6 +298,8 @@ i386_show_dr (const char *func, CORE_ADD
{
int i;
+ dr_mirror_fetch ();
+
puts_unfiltered (func);
if (addr || len)
printf_unfiltered (" (addr=%lx, len=%d, type=%s)",
@@ -337,6 +389,8 @@ i386_insert_aligned_watchpoint (CORE_ADD
{
int i;
+ dr_mirror_fetch ();
+
/* First, look for an occupied debug register with the same address
and the same RW and LEN definitions. If we find one, we can
reuse it for this watchpoint as well (and save a register). */
@@ -397,6 +451,8 @@ i386_remove_aligned_watchpoint (CORE_ADD
{
int i, retval = -1;
+ dr_mirror_fetch ();
+
ALL_DEBUG_REGISTERS(i)
{
if (!I386_DR_VACANT (i)
@@ -569,6 +625,8 @@ i386_stopped_data_address (CORE_ADDR *ad
int i;
int rc = 0;
+ dr_mirror_fetch ();
+
dr_status_mirror = I386_DR_LOW_GET_STATUS ();
ALL_DEBUG_REGISTERS(i)
@@ -610,6 +668,8 @@ i386_stopped_by_hwbp (void)
{
int i;
+ dr_mirror_fetch ();
+
dr_status_mirror = I386_DR_LOW_GET_STATUS ();
if (maint_show_dr)
i386_show_dr ("stopped_by_hwbp", 0, 0, hw_execute);
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.base/watchpoint-fork.c 14 Oct 2007 15:00:32 -0000
@@ -0,0 +1,73 @@
+/* Test case for forgotten hw-watchpoints after fork()-off of a process.
+
+ Copyright 2007
+ Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <assert.h>
+#include <unistd.h>
+#include <sys/wait.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+static volatile int var;
+
+static void breakpoint (void)
+{
+}
+
+static void forkoff (int nr)
+{
+ pid_t child, pid_got;
+ int exit_code = 42 + nr;
+ int status;
+
+ child = fork ();
+ switch (child)
+ {
+ case -1:
+ assert (0);
+ case 0:
+ printf ("child%d: %d\n", nr, (int) getpid ());
+ breakpoint ();
+ exit (exit_code);
+ default:
+ printf ("parent%d: %d\n", nr, (int) child);
+ pid_got = wait (&status);
+ assert (pid_got == child);
+ assert (WIFEXITED (status));
+ assert (WEXITSTATUS (status) == exit_code);
+ }
+}
+
+int main (void)
+{
+ setbuf (stdout, NULL);
+ printf ("main: %d\n", (int) getpid ());
+
+ /* Hardware watchpoints got disarmed here. */
+ forkoff (1);
+ /* This watchpoint got lost before. */
+ var++;
+ /* A sanity check for double hardware watchpoints removal. */
+ forkoff (2);
+ var++;
+
+ return 0;
+}
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.base/watchpoint-fork.exp 14 Oct 2007 15:00:32 -0000
@@ -0,0 +1,46 @@
+# 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 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 $tracelevel then {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+set testfile watchpoint-fork
+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}
+
+gdb_test "watch var" "atchpoint 1: var"
+# It is never hit but it should not be left over in the fork()ed-off child.
+gdb_breakpoint "breakpoint"
+gdb_run_cmd
+gdb_test "" \
+ "atchpoint 1: var.*Old value = 0.*New value = 1.*" "watchpoint first hit"
+gdb_test "continue" \
+ "atchpoint 1: var.*Old value = 1.*New value = 2.*" "watchpoint second hit"
+gdb_test "continue" "Continuing..*Program exited normally." "finish"
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.434
retrieving revision 1.435
diff -u -r1.434 -r1.435
--- src/gdb/doc/gdb.texinfo 2007/09/28 11:09:55 1.434
+++ src/gdb/doc/gdb.texinfo 2007/10/01 00:17:58 1.435
@@ -3346,20 +3346,13 @@
way of doing that would be to set a code breakpoint at the entry to the
@code{main} function and when it breaks, set all the watchpoints.
-@quotation
@cindex watchpoints and threads
@cindex threads and watchpoints
-@emph{Warning:} In multi-thread programs, watchpoints have only limited
-usefulness. With the current watchpoint implementation, @value{GDBN}
-can only watch the value of an expression @emph{in a single thread}. If
-you are confident that the expression can only change due to the current
-thread's activity (and if you are also confident that no other thread
-can become current), then you can use watchpoints as usual. However,
-@value{GDBN} may not notice when a non-current thread's activity changes
-the expression.
+In multi-threaded programs, watchpoints will detect changes to the
+watched expression from every thread.
-@c FIXME: this is almost identical to the previous paragraph.
-@emph{HP-UX Warning:} In multi-thread programs, software watchpoints
+@quotation
+@emph{Warning:} In multi-threaded programs, software watchpoints
have only limited usefulness. If @value{GDBN} creates a software
watchpoint, it can only watch the value of an expression @emph{in a
single thread}. If you are confident that the expression can only
--- gdb-6.5/gdb/doc/gdb.texinfo-orig 2007-12-15 13:25:14.000000000 +0100
+++ gdb-6.5/gdb/doc/gdb.texinfo 2007-12-15 13:45:25.000000000 +0100
@@ -3261,6 +3261,14 @@
software watchpoints as usual. However, @value{GDBN} may not notice
when a non-current thread's activity changes the expression. (Hardware
watchpoints, in contrast, watch an expression in all threads.)
+
+Software watchpoints single-step the current thread to track the changes.
+Other threads are left freely running on @code{continue}; therefore, their
+changes cannot be caught. To get more reliable software watchpoints, please
+use @code{set scheduler-locking on}. The default for Red Hat/Fedora
+@value{GDBN} is @code{set scheduler-locking step}, which makes the software
+watchpoints safe for the @code{step} command, but not for the @code{continue}
+command. @xref{Thread Stops}.
@end quotation
@xref{set remote hardware-watchpoint-limit}.

View File

@ -12,6 +12,11 @@
the software watchpoint events.
* linux-nat.h (struct lwp_info): Redeclare STEP as ENUM RESUME_STEP.
2007-10-19 Jan Kratochvil <jan.kratochvil@redhat.com>
* infrun.c (proceed): RESUME_STEP initialized for non-stepping.
RESUME_STEP set according to STEP only at the end of the function.
--- ./gdb/inferior.h 15 Jun 2007 22:44:55 -0000 1.83
+++ ./gdb/inferior.h 25 Jun 2007 20:33:02 -0000
@@ -194,7 +194,15 @@ extern void reopen_exec_file (void);
@ -78,13 +83,12 @@
{
/* User-settable 'scheduler' mode requires solo thread resume. */
resume_ptid = inferior_ptid;
@@ -711,7 +716,8 @@ static CORE_ADDR prev_pc;
@@ -711,7 +716,7 @@ static CORE_ADDR prev_pc;
void
proceed (CORE_ADDR addr, enum target_signal siggnal, int step)
{
- int oneproc = 0;
+ enum resume_step resume_step = (step ? RESUME_STEP_USER
+ : RESUME_STEP_CONTINUE);
+ enum resume_step resume_step = RESUME_STEP_CONTINUE;
if (step > 0)
step_start_function = find_pc_function (read_pc ());
@ -116,10 +120,12 @@
/* We will get a trace trap after one instruction.
Continue it automatically and insert breakpoints then. */
trap_expected = 1;
@@ -806,8 +812,11 @@ proceed (CORE_ADDR addr, enum target_sig
@@ -806,8 +812,13 @@ proceed (CORE_ADDR addr, enum target_sig
updated correctly when the inferior is stopped. */
prev_pc = read_pc ();
+ if (step)
+ resume_step = RESUME_STEP_USER;
+ if (resume_step == RESUME_STEP_CONTINUE && bpstat_should_step ())
+ resume_step = RESUME_STEP_NEEDED;
+

View File

@ -0,0 +1,25 @@
--- gdb-6.6/gdb/testsuite/gdb.threads/staticthreads.exp-orig 2005-04-30 21:56:47.000000000 +0200
+++ gdb-6.6/gdb/testsuite/gdb.threads/staticthreads.exp 2008-01-11 14:30:15.000000000 +0100
@@ -44,9 +44,21 @@ gdb_load ${binfile}
gdb_test "set print sevenbit-strings" ""
+runto_main
+
+# See if we get excessive LWP there (patched glibc with unpatched GDB):
+# * 2 Thread 135661664 (LWP 3856) main () at threadloop.c:41
+# 1 process 3856 main () at threadloop.c:41
+
+set test "info threads on start"
+gdb_test_multiple "info threads" "$test" {
+ -re "^info threads\r?\n\[^\r\n\]* Thread \[^\r\n\]*\r?\n$gdb_prompt" {
+ pass "$test"
+ }
+}
+
# See if the static multi-threaded program runs.
-runto_main
gdb_test "break sem_post"
set test "Continue to main's call of sem_post"
gdb_test_multiple "continue" "$test" {

View File

@ -864,7 +864,7 @@ IBM OzLabs - Linux Technology Centre
- if (!decode_for_pst_p)
- {
- last_subfile = current_subfile;
- dwarf2_start_subfile (fe->name, dir, comp_dir, file);
- dwarf2_start_subfile (fe->name, dir, comp_dir);
- }
+ if (lh->num_file_names < file)
+ dwarf2_debug_line_missing_file_complaint ();
@ -876,7 +876,7 @@ IBM OzLabs - Linux Technology Centre
+ if (!decode_for_pst_p)
+ {
+ last_subfile = current_subfile;
+ dwarf2_start_subfile (fe->name, dir, comp_dir, file);
+ dwarf2_start_subfile (fe->name, dir, comp_dir);
+ }
+ }
}
@ -1163,3 +1163,382 @@ http://sourceware.org/ml/binutils/2007-08/msg00296.html
:
else
MAKEINFO="$MISSING makeinfo"
gdb/
https://bugzilla.redhat.com/show_bug.cgi?id=314131
gdb/gdbserver/
https://bugzilla.redhat.com/show_bug.cgi?id=328021
http://sourceware.org/ml/gdb-patches/2007-06/msg00479.html
http://sourceware.org/ml/gdb-cvs/2007-06/msg00175.html
gdb/
2007-06-27 Daniel Jacobowitz <dan@codesourcery.com>
* linux-thread-db.c (thread_db_attach): Delete.
(thread_db_detach): Typo fix. Call target_mourn_inferior
instead of fixing up proc_handle.
(have_threads_callback, have_threads): New functions.
(thread_db_wait): Remove dead proc_handle.pid check. Only
translate PTIDs if we have registered threads. Check for new
threads if we have none.
(thread_db_create_inferior, thread_db_post_startup_inferior): Delete.
(find_new_threads_callback): Only enable event reporting if TID == 0.
(same_ptid_callback): New.
(thread_db_get_thread_local_address): Check for new threads.
(init_thread_db_ops): Don't set to_attach, to_create_inferior,
or to_post_startup_inferior.
gdb/gdbserver/
2007-06-27 Daniel Jacobowitz <dan@codesourcery.com>
* thread-db.c (thread_db_find_new_threads): Add prototype.
(thread_db_create_event): Check for the main thread before adding
a new thread.
(maybe_attach_thread): Only enable event reporting if TID == 0.
(thread_db_get_tls_address): Check for new threads.
--- gdb-6.6/gdb/linux-thread-db.c 2008-01-10 19:38:49.000000000 +0100
+++ gdb-6.6-patched/gdb/linux-thread-db.c 2008-01-10 19:35:58.000000000 +0100
@@ -214,6 +214,21 @@ thread_db_err_str (td_err_e err)
}
}
+/* Return 1 if any threads have been registered. There may be none if
+ the threading library is not fully initialized yet. */
+
+static int
+have_threads_callback (struct thread_info *thread, void *dummy)
+{
+ return 1;
+}
+
+static int
+have_threads (void)
+{
+ return iterate_over_threads (have_threads_callback, NULL) != NULL;
+}
+
/* A callback function for td_ta_thr_iter, which we use to map all
threads to LWPs.
@@ -706,23 +721,6 @@ attach_thread (ptid_t ptid, const td_thr
}
static void
-thread_db_attach (char *args, int from_tty)
-{
- target_beneath->to_attach (args, from_tty);
-
- /* Destroy thread info; it's no longer valid. */
- init_thread_list ();
-
- /* The child process is now the actual multi-threaded
- program. Snatch its process ID... */
- proc_handle.pid = GET_PID (inferior_ptid);
-
- /* ...and perform the remaining initialization steps. */
- enable_thread_event_reporting ();
- thread_db_find_new_threads ();
-}
-
-static void
detach_thread (ptid_t ptid, int verbose)
{
struct thread_info *thread_info;
@@ -748,14 +746,13 @@ thread_db_detach (char *args, int from_t
disable_thread_event_reporting ();
/* There's no need to save & restore inferior_ptid here, since the
- inferior is supposed to be survive this function call. */
+ inferior is not supposed to survive this function call. */
inferior_ptid = lwp_from_thread (inferior_ptid);
- /* Forget about the child's process ID. We shouldn't need it
- anymore. */
- proc_handle.pid = 0;
-
target_beneath->to_detach (args, from_tty);
+
+ /* Should this be done by detach_command? */
+ target_mourn_inferior ();
}
static void
@@ -860,12 +857,6 @@ thread_db_wait (ptid_t ptid, struct targ
ptid = target_beneath->to_wait (ptid, ourstatus);
- if (proc_handle.pid == 0)
- /* The current child process isn't the actual multi-threaded
- program yet, so don't try to do any special thread-specific
- post-processing and bail out early. */
- return ptid;
-
if (ourstatus->kind == TARGET_WAITKIND_EXITED
|| ourstatus->kind == TARGET_WAITKIND_SIGNALLED)
return pid_to_ptid (-1);
@@ -896,24 +887,33 @@
return pid_to_ptid (GET_PID (ptid));
}
+ /* If we do not know about the main thread yet, this would be a good time to
+ find it. */
+ if (ourstatus->kind == TARGET_WAITKIND_STOPPED && !have_threads ())
+ thread_db_find_new_threads ();
+
if (ourstatus->kind == TARGET_WAITKIND_STOPPED
&& (ourstatus->value.sig == TARGET_SIGNAL_TRAP
|| ourstatus->value.sig == TARGET_SIGNAL_ILL))
/* Check for a thread event. */
check_event (ptid);
- if (!ptid_equal (trap_ptid, null_ptid))
- trap_ptid = thread_from_lwp (trap_ptid);
+ if (have_threads ())
+ {
+ /* Change ptids back into the higher level PID + TID format. If
+ the thread is dead and no longer on the thread list, we will
+ get back a dead ptid. This can occur if the thread death
+ event gets postponed by other simultaneous events. In such a
+ case, we want to just ignore the event and continue on. */
+
+ if (!ptid_equal (trap_ptid, null_ptid))
+ trap_ptid = thread_from_lwp (trap_ptid);
+
+ ptid = thread_from_lwp (ptid);
+ if (GET_PID (ptid) == -1)
+ ourstatus->kind = TARGET_WAITKIND_SPURIOUS;
+ }
- /* Change the ptid back into the higher level PID + TID format.
- If the thread is dead and no longer on the thread list, we will
- get back a dead ptid. This can occur if the thread death event
- gets postponed by other simultaneous events. In such a case,
- we want to just ignore the event and continue on. */
- ptid = thread_from_lwp (ptid);
- if (GET_PID (ptid) == -1)
- ourstatus->kind = TARGET_WAITKIND_SPURIOUS;
-
return ptid;
}
@@ -935,30 +935,6 @@ thread_db_kill (void)
}
static void
-thread_db_create_inferior (char *exec_file, char *allargs, char **env,
- int from_tty)
-{
- unpush_target (&thread_db_ops);
- using_thread_db = 0;
- target_beneath->to_create_inferior (exec_file, allargs, env, from_tty);
-}
-
-static void
-thread_db_post_startup_inferior (ptid_t ptid)
-{
- if (proc_handle.pid == 0)
- {
- /* The child process is now the actual multi-threaded
- program. Snatch its process ID... */
- proc_handle.pid = GET_PID (ptid);
-
- /* ...and perform the remaining initialization steps. */
- enable_thread_event_reporting ();
- thread_db_find_new_threads ();
- }
-}
-
-static void
thread_db_mourn_inferior (void)
{
/* Forget about the child's process ID. We shouldn't need it
@@ -993,6 +969,22 @@ find_new_threads_callback (const td_thrh
ptid = ptid_build (GET_PID (inferior_ptid), ti.ti_lid, ti.ti_tid);
+ if (ti.ti_tid == 0)
+ {
+ /* A thread ID of zero means that this is the main thread, but
+ glibc has not yet initialized thread-local storage and the
+ pthread library. We do not know what the thread's TID will
+ be yet. Just enable event reporting and otherwise ignore
+ it. */
+
+ err = td_thr_event_enable_p (th_p, 1);
+ if (err != TD_OK)
+ error (_("Cannot enable thread event reporting for %s: %s"),
+ target_pid_to_str (ptid), thread_db_err_str (err));
+
+ return 0;
+ }
+
if (!in_thread_list (ptid))
attach_thread (ptid, th_p, &ti, 1);
@@ -1049,6 +1041,16 @@ thread_db_extra_thread_info (struct thre
return NULL;
}
+/* Return 1 if this thread has the same LWP as the passed PTID. */
+
+static int
+same_ptid_callback (struct thread_info *thread, void *arg)
+{
+ ptid_t *ptid_p = arg;
+
+ return GET_LWP (thread->ptid) == GET_LWP (*ptid_p);
+}
+
/* Get the address of the thread local variable in load module LM which
is stored at OFFSET within the thread local storage for thread PTID. */
@@ -1057,6 +1059,21 @@ thread_db_get_thread_local_address (ptid
CORE_ADDR lm,
CORE_ADDR offset)
{
+ /* If we have not discovered any threads yet, check now. */
+ if (!is_thread (ptid) && !have_threads ())
+ thread_db_find_new_threads ();
+
+ /* Try to find a matching thread if we still have the LWP ID instead
+ of the thread ID. */
+ if (!is_thread (ptid))
+ {
+ struct thread_info *thread;
+
+ thread = iterate_over_threads (same_ptid_callback, &ptid);
+ if (thread != NULL)
+ ptid = thread->ptid;
+ }
+
if (is_thread (ptid))
{
td_err_e err;
@@ -1116,14 +1133,11 @@ init_thread_db_ops (void)
thread_db_ops.to_shortname = "multi-thread";
thread_db_ops.to_longname = "multi-threaded child process.";
thread_db_ops.to_doc = "Threads and pthreads support.";
- thread_db_ops.to_attach = thread_db_attach;
thread_db_ops.to_detach = thread_db_detach;
thread_db_ops.to_resume = thread_db_resume;
thread_db_ops.to_wait = thread_db_wait;
thread_db_ops.to_xfer_partial = thread_db_xfer_partial;
thread_db_ops.to_kill = thread_db_kill;
- thread_db_ops.to_create_inferior = thread_db_create_inferior;
- thread_db_ops.to_post_startup_inferior = thread_db_post_startup_inferior;
thread_db_ops.to_mourn_inferior = thread_db_mourn_inferior;
thread_db_ops.to_find_new_threads = thread_db_find_new_threads;
thread_db_ops.to_pid_to_str = thread_db_pid_to_str;
--- ./gdb/gdbserver/thread-db.c 9 Jan 2007 17:59:08 -0000 1.9
+++ ./gdb/gdbserver/thread-db.c 27 Jun 2007 11:52:02 -0000 1.10
@@ -41,6 +41,7 @@ static struct ps_prochandle proc_handle;
/* Connection to the libthread_db library. */
static td_thragent_t *thread_agent;
+static void thread_db_find_new_threads (void);
static int find_new_threads_callback (const td_thrhandle_t *th_p, void *data);
static char *
@@ -135,6 +136,8 @@ thread_db_create_event (CORE_ADDR where)
td_event_msg_t msg;
td_err_e err;
struct inferior_linux_data *tdata;
+ struct thread_info *inferior;
+ struct process_info *process;
if (debug_threads)
fprintf (stderr, "Thread creation event.\n");
@@ -150,6 +153,14 @@ thread_db_create_event (CORE_ADDR where)
fprintf (stderr, "thread getmsg err: %s\n",
thread_db_err_str (err));
+ /* If we do not know about the main thread yet, this would be a good time to
+ find it. We need to do this to pick up the main thread before any newly
+ created threads. */
+ inferior = (struct thread_info *) all_threads.head;
+ process = get_thread_process (inferior);
+ if (process->thread_known == 0)
+ thread_db_find_new_threads ();
+
/* msg.event == TD_EVENT_CREATE */
find_new_threads_callback (msg.th_p, NULL);
@@ -232,8 +243,24 @@ maybe_attach_thread (const td_thrhandle_
{
inferior = (struct thread_info *) all_threads.head;
process = get_thread_process (inferior);
+
if (process->thread_known == 0)
{
+ /* If the new thread ID is zero, a final thread ID will be
+ available later. Do not enable thread debugging yet. */
+ if (ti_p->ti_tid == 0)
+ {
+ err = td_thr_event_enable (th_p, 1);
+ if (err != TD_OK)
+ error ("Cannot enable thread event reporting for %d: %s",
+ ti_p->ti_lid, thread_db_err_str (err));
+ return;
+ }
+
+ if (process->lwpid != ti_p->ti_lid)
+ fatal ("PID mismatch! Expected %ld, got %ld",
+ (long) process->lwpid, (long) ti_p->ti_lid);
+
/* Switch to indexing the threads list by TID. */
change_inferior_id (&all_threads, ti_p->ti_tid);
goto found;
@@ -332,6 +359,8 @@ thread_db_get_tls_address (struct thread
process = get_thread_process (thread);
if (!process->thread_known)
+ thread_db_find_new_threads ();
+ if (!process->thread_known)
return TD_NOTHR;
/* Note the cast through uintptr_t: this interface only works if
http://sources.redhat.com/ml/gdb-patches/2007-07/msg00034.html
2007-07-02 Daniel Jacobowitz <dan@codesourcery.com>
* breakpoint.c (reattach_breakpoints): Do not use remove_breakpoint.
Call insert_bp_location.
[ Backported. ]
--- gdb-6.6/gdb/breakpoint.c.orig 2007-10-14 17:42:36.000000000 +0200
+++ gdb-6.6/gdb/breakpoint.c 2007-10-14 17:45:57.000000000 +0200
@@ -1313,20 +1313,19 @@
struct bp_location *b;
int val;
struct cleanup *old_chain = save_inferior_ptid ();
+ struct ui_file *tmp_error_stream = mem_fileopen ();
+ int dummy1 = 0, dummy2 = 0, dummy3 = 0;
+
+ make_cleanup_ui_file_delete (tmp_error_stream);
- /* Set inferior_ptid; remove_breakpoint uses this global. */
inferior_ptid = pid_to_ptid (pid);
ALL_BP_LOCATIONS (b)
{
if (b->inserted)
{
- remove_breakpoint (b, mark_inserted);
- if (b->loc_type == bp_loc_hardware_breakpoint)
- val = target_insert_hw_breakpoint (&b->target_info);
- else
- val = target_insert_breakpoint (&b->target_info);
- /* FIXME drow/2003-10-07: This doesn't handle any other kinds of
- breakpoints. It's wrong for watchpoints, for example. */
+ b->inserted = 0;
+ val = insert_bp_location (b, tmp_error_stream,
+ &dummy1, &dummy2, &dummy3);
if (val != 0)
{
do_cleanups (old_chain);

656
gdb-6.6-upstream2.patch Normal file
View File

@ -0,0 +1,656 @@
https://bugzilla.redhat.com/show_bug.cgi?id=435819
http://sourceware.org/ml/gdb-cvs/2008-01/msg00203.html
2008-01-29 Daniel Jacobowitz <dan@codesourcery.com>
* Makefile.in (symfile.o): Update.
* NEWS: Mention exec tracing support.
* inf-ttrace.c (inf_ttrace_wait): Return TARGET_WAITKIND_EXECD for
exec events.
* infcmd.c (kill_if_already_running, detach_command)
(disconnect_command): Replace SOLIB_RESTART with no_shared_libraries.
* infrun.c (MAY_FOLLOW_EXEC, may_follow_exec): Delete.
(follow_exec): Do not check may_follow_exec. Do not mourn and push
targets. Apply the sysroot path to the loaded executable. Use
no_shared_libraries.
* linux-nat.c (linux_child_follow_fork): Print fork following
messages if verbose.
(kill_wait_callback): Kill again before waiting a second time.
* symfile.c (symbol_file_clear): Replace SOLIB_RESTART with
no_shared_libraries.
2008-01-29 Daniel Jacobowitz <dan@codesourcery.com>
* gdb.base/foll-exec.exp: Update header. Skip on remote targets.
Run on GNU/Linux.
(do_exec_tests): Check for systems which do not support catchpoints.
Do not match START.
* gdb.base/foll-fork.exp: Update header. Skip on remote targets.
Run on GNU/Linux. Enable verbose output.
(check_fork_catchpoints): New.
(explicit_fork_child_follow, catch_fork_child_follow)
(tcatch_fork_parent_follow): Update expected messages.
(do_fork_tests): Use check_fork_catchpoints.
* gdb.base/foll-vfork.exp: Update header. Skip on remote targets.
Run on GNU/Linux. Enable verbose output.
(check_vfork_catchpoints): New.
(vfork_parent_follow_to_bp, tcatch_vfork_then_child_follow): Update
expected messages.
(do_vfork_and_exec_tests): Use check_fork_catchpoints.
[ Backport for GDB-6.6. ]
diff -up -u -X /home/jkratoch/.diffi.list -ruNp gdb-6.6-orig/gdb/Makefile.in gdb-6.6/gdb/Makefile.in
--- gdb-6.6-orig/gdb/Makefile.in 2008-03-13 21:17:46.000000000 +0100
+++ gdb-6.6/gdb/Makefile.in 2008-03-13 21:20:40.000000000 +0100
@@ -2788,7 +2788,7 @@ symfile.o: symfile.c $(defs_h) $(bfdlink
$(hashtab_h) $(readline_h) $(gdb_assert_h) $(block_h) \
$(gdb_string_h) $(gdb_stat_h) $(observer_h) $(exec_h) \
$(parser_defs_h) $(elf_bfd_h) $(gdb_stdint_h) $(libbfd_h) $(elf_bfd_h) \
- $(elf_external_h)
+ $(elf_external_h) $(solib_h)
symfile-mem.o: symfile-mem.c $(defs_h) $(symtab_h) $(gdbcore_h) \
$(objfiles_h) $(exceptions_h) $(gdbcmd_h) $(target_h) $(value_h) \
$(symfile_h) $(observer_h) $(auxv_h) $(elf_common_h)
diff -up -u -X /home/jkratoch/.diffi.list -ruNp gdb-6.6-orig/gdb/NEWS gdb-6.6/gdb/NEWS
--- gdb-6.6-orig/gdb/NEWS 2008-03-13 21:17:46.000000000 +0100
+++ gdb-6.6/gdb/NEWS 2008-03-13 21:21:14.000000000 +0100
@@ -1,6 +1,11 @@
What has changed in GDB?
(Organized release by release)
+*** Changes in post-GDB 6.6 (backports)
+
+* GDB on GNU/Linux and HP/UX can now debug through "exec" of a new
+process.
+
*** Changes in GDB 6.6
* New targets
diff -up -u -X /home/jkratoch/.diffi.list -ruNp gdb-6.6-orig/gdb/infcmd.c gdb-6.6/gdb/infcmd.c
--- gdb-6.6-orig/gdb/infcmd.c 2006-11-20 22:58:51.000000000 +0100
+++ gdb-6.6/gdb/infcmd.c 2008-03-13 21:20:17.000000000 +0100
@@ -447,9 +447,7 @@ kill_if_already_running (int from_tty)
Start it from the beginning? "))
error (_("Program not restarted."));
target_kill ();
-#if defined(SOLIB_RESTART)
- SOLIB_RESTART ();
-#endif
+ no_shared_libraries (NULL, from_tty);
init_wait_for_inferior ();
}
}
@@ -1962,9 +1960,7 @@ detach_command (char *args, int from_tty
{
dont_repeat (); /* Not for the faint of heart. */
target_detach (args, from_tty);
-#if defined(SOLIB_RESTART)
- SOLIB_RESTART ();
-#endif
+ no_shared_libraries (NULL, from_tty);
if (deprecated_detach_hook)
deprecated_detach_hook ();
}
@@ -1982,9 +1978,7 @@ disconnect_command (char *args, int from
{
dont_repeat (); /* Not for the faint of heart */
target_disconnect (args, from_tty);
-#if defined(SOLIB_RESTART)
- SOLIB_RESTART ();
-#endif
+ no_shared_libraries (NULL, from_tty);
if (deprecated_detach_hook)
deprecated_detach_hook ();
}
diff -up -u -X /home/jkratoch/.diffi.list -ruNp gdb-6.6-orig/gdb/infrun.c gdb-6.6/gdb/infrun.c
--- gdb-6.6-orig/gdb/infrun.c 2008-03-13 21:17:46.000000000 +0100
+++ gdb-6.6/gdb/infrun.c 2008-03-13 21:20:17.000000000 +0100
@@ -110,15 +110,6 @@ int sync_execution = 0;
static ptid_t previous_inferior_ptid;
-/* This is true for configurations that may follow through execl() and
- similar functions. At present this is only true for HP-UX native. */
-
-#ifndef MAY_FOLLOW_EXEC
-#define MAY_FOLLOW_EXEC (0)
-#endif
-
-static int may_follow_exec = MAY_FOLLOW_EXEC;
-
static int debug_infrun = 0;
static void
show_debug_infrun (struct ui_file *file, int from_tty,
@@ -385,9 +376,6 @@ follow_exec (int pid, char *execd_pathna
int saved_pid = pid;
struct target_ops *tgt;
- if (!may_follow_exec)
- return;
-
/* This is an exec event that we actually wish to pay attention to.
Refresh our symbol table to the newly exec'd program, remove any
momentary bp's, etc.
@@ -422,17 +410,20 @@ follow_exec (int pid, char *execd_pathna
/* We've followed the inferior through an exec. Therefore, the
inferior has essentially been killed & reborn. */
- /* First collect the run target in effect. */
- tgt = find_run_target ();
- /* If we can't find one, things are in a very strange state... */
- if (tgt == NULL)
- error (_("Could find run target to save before following exec"));
-
gdb_flush (gdb_stdout);
- target_mourn_inferior ();
- inferior_ptid = pid_to_ptid (saved_pid);
+ generic_mourn_inferior ();
/* Because mourn_inferior resets inferior_ptid. */
- push_target (tgt);
+ inferior_ptid = pid_to_ptid (saved_pid);
+
+ if (gdb_sysroot && *gdb_sysroot)
+ {
+ char *name = alloca (strlen (gdb_sysroot)
+ + strlen (execd_pathname)
+ + 1);
+ strcpy (name, gdb_sysroot);
+ strcat (name, execd_pathname);
+ execd_pathname = name;
+ }
/* That a.out is now the one to use. */
exec_file_attach (execd_pathname, 0);
@@ -443,9 +434,7 @@ follow_exec (int pid, char *execd_pathna
/* Reset the shared library package. This ensures that we get
a shlib event when the child reaches "_start", at which point
the dld will have had a chance to initialize the child. */
-#if defined(SOLIB_RESTART)
- SOLIB_RESTART ();
-#endif
+ no_shared_libraries (NULL, 0);
#ifdef SOLIB_CREATE_INFERIOR_HOOK
SOLIB_CREATE_INFERIOR_HOOK (PIDGET (inferior_ptid));
#else
diff -up -u -X /home/jkratoch/.diffi.list -ruNp gdb-6.6-orig/gdb/linux-nat.c gdb-6.6/gdb/linux-nat.c
--- gdb-6.6-orig/gdb/linux-nat.c 2008-03-13 21:17:46.000000000 +0100
+++ gdb-6.6/gdb/linux-nat.c 2008-03-13 21:22:47.000000000 +0100
@@ -416,7 +416,7 @@ child_follow_fork (struct target_ops *op
_(" (Try `set detach-on-fork off'.)")));
advice_printed = 1;
- if (debug_linux_nat)
+ if (info_verbose || debug_linux_nat)
{
fprintf_filtered (gdb_stdlog,
"Detaching after fork from child process %d.\n",
@@ -500,7 +500,7 @@ child_follow_fork (struct target_ops *op
/* Before detaching from the parent, remove all breakpoints from it. */
remove_breakpoints ();
- if (debug_linux_nat)
+ if (info_verbose || debug_linux_nat)
{
target_terminal_ours ();
fprintf_filtered (gdb_stdlog,
@@ -2590,11 +2590,18 @@ kill_wait_callback (struct lwp_info *lp,
do
{
pid = my_waitpid (GET_LWP (lp->ptid), NULL, __WCLONE);
- if (pid != (pid_t) -1 && debug_linux_nat)
+ if (pid != (pid_t) -1)
{
- fprintf_unfiltered (gdb_stdlog,
- "KWC: wait %s received unknown.\n",
- target_pid_to_str (lp->ptid));
+ if (debug_linux_nat)
+ fprintf_unfiltered (gdb_stdlog,
+ "KWC: wait %s received unknown.\n",
+ target_pid_to_str (lp->ptid));
+ /* The Linux kernel sometimes fails to kill a thread
+ completely after PTRACE_KILL; that goes from the stop
+ point in do_fork out to the one in
+ get_signal_to_deliever and waits again. So kill it
+ again. */
+ kill_callback (lp, NULL);
}
}
while (pid == GET_LWP (lp->ptid));
@@ -2605,11 +2612,14 @@ kill_wait_callback (struct lwp_info *lp,
do
{
pid = my_waitpid (GET_LWP (lp->ptid), NULL, 0);
- if (pid != (pid_t) -1 && debug_linux_nat)
+ if (pid != (pid_t) -1)
{
- fprintf_unfiltered (gdb_stdlog,
- "KWC: wait %s received unk.\n",
- target_pid_to_str (lp->ptid));
+ if (debug_linux_nat)
+ fprintf_unfiltered (gdb_stdlog,
+ "KWC: wait %s received unk.\n",
+ target_pid_to_str (lp->ptid));
+ /* See the call to kill_callback above. */
+ kill_callback (lp, NULL);
}
}
while (pid == GET_LWP (lp->ptid));
diff -up -u -X /home/jkratoch/.diffi.list -ruNp gdb-6.6-orig/gdb/symfile.c gdb-6.6/gdb/symfile.c
--- gdb-6.6-orig/gdb/symfile.c 2008-03-13 21:17:46.000000000 +0100
+++ gdb-6.6/gdb/symfile.c 2008-03-13 21:23:06.000000000 +0100
@@ -57,6 +57,7 @@
#include "gdb_stdint.h"
#include "libbfd.h"
#include "elf/external.h"
+#include "solib.h"
#include <sys/types.h>
#include <fcntl.h>
@@ -1136,9 +1137,7 @@ symbol_file_clear (int from_tty)
storage has just been released, we'd better wipe the solib
descriptors as well.
*/
-#if defined(SOLIB_RESTART)
- SOLIB_RESTART ();
-#endif
+ no_shared_libraries (NULL, from_tty);
symfile_objfile = NULL;
if (from_tty)
diff -up -u -X /home/jkratoch/.diffi.list -ruNp gdb-6.6-orig/gdb/testsuite/gdb.base/foll-exec.exp gdb-6.6/gdb/testsuite/gdb.base/foll-exec.exp
--- gdb-6.6-orig/gdb/testsuite/gdb.base/foll-exec.exp 2006-08-10 07:27:20.000000000 +0200
+++ gdb-6.6/gdb/testsuite/gdb.base/foll-exec.exp 2008-03-13 21:24:26.000000000 +0100
@@ -21,7 +21,7 @@ if $tracelevel then {
strace $tracelevel
}
-if { ![isnative] } then {
+if { [is_remote target] || ![isnative] } then {
continue
}
@@ -49,7 +49,7 @@ if { [gdb_compile "${srcdir}/${subdir}/
# Until "catch exec" is implemented on other targets...
#
-if ![istarget "hppa*-hp-hpux*"] then {
+if {![istarget "hppa*-hp-hpux*"] && ![istarget "*-linux*"]} then {
continue
}
@@ -94,6 +94,33 @@ proc do_exec_tests {} {
return
}
+ # Verify that the system supports "catch exec".
+ gdb_test "catch exec" "Catchpoint \[0-9\]* \\(exec\\)" "insert first exec catchpoint"
+ set has_exec_catchpoints 0
+ gdb_test_multiple "continue" "continue to first exec catchpoint" {
+ -re ".*Your system does not support exec catchpoints.*$gdb_prompt $" {
+ unsupported "continue to first exec catchpoint"
+ }
+ -re ".*Catchpoint.*$gdb_prompt $" {
+ set has_exec_catchpoints 1
+ pass "continue to first exec catchpoint"
+ }
+ }
+
+ if {$has_exec_catchpoints == 0} {
+ unsupported "exec catchpoints"
+ return
+ }
+
+ zap_session
+
+ # Start the program running, and stop at main.
+ #
+ if ![runto_main] then {
+ perror "Couldn't run ${testfile}"
+ return
+ }
+
# Verify that we can see various global and local variables
# in this program, and that they have expected values. Some
# of these variables are also declared in the program we'll
@@ -214,7 +241,7 @@ proc do_exec_tests {} {
setup_xfail hppa2.0w-hp-hpux* CLLbs16760
send_gdb "continue\n"
gdb_expect {
- -re ".*Executing new program:.*${testfile2}.*Catchpoint .*(exec\'d .*${testfile2}).*in .START..*$gdb_prompt $"\
+ -re ".*Executing new program:.*${testfile2}.*Catchpoint .*(exec\'d .*${testfile2}).*in .*$gdb_prompt $"\
{pass "hit catch exec"}
-re "$gdb_prompt $" {fail "hit catch exec"}
timeout {fail "(timeout) hit catch exec"}
diff -up -u -X /home/jkratoch/.diffi.list -ruNp gdb-6.6-orig/gdb/testsuite/gdb.base/foll-fork.exp gdb-6.6/gdb/testsuite/gdb.base/foll-fork.exp
--- gdb-6.6-orig/gdb/testsuite/gdb.base/foll-fork.exp 2006-08-10 07:27:20.000000000 +0200
+++ gdb-6.6/gdb/testsuite/gdb.base/foll-fork.exp 2008-03-13 21:24:54.000000000 +0100
@@ -21,13 +21,14 @@ if $tracelevel then {
strace $tracelevel
}
-if { ![isnative] } then {
+if { [is_remote target] || ![isnative] } then {
continue
}
set prms_id 0
set bug_id 0
+global srcfile
set testfile "foll-fork"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
@@ -42,10 +43,32 @@ if { [gdb_compile "${srcdir}/${subdir}/
# Until "set follow-fork-mode" and "catch fork" are implemented on
# other targets...
#
-if ![istarget "hppa*-hp-hpux*"] then {
+if {![istarget "hppa*-hp-hpux*"] && ![istarget "*-linux*"]} then {
continue
}
+proc check_fork_catchpoints {} {
+ global gdb_prompt
+
+ # Verify that the system supports "catch fork".
+ gdb_test "catch fork" "Catchpoint \[0-9\]* \\(fork\\)" "insert first fork catchpoint"
+ set has_fork_catchpoints 0
+ gdb_test_multiple "continue" "continue to first fork catchpoint" {
+ -re ".*Your system does not support fork catchpoints.*$gdb_prompt $" {
+ unsupported "continue to first fork catchpoint"
+ }
+ -re ".*Catchpoint.*$gdb_prompt $" {
+ set has_fork_catchpoints 1
+ pass "continue to first fork catchpoint"
+ }
+ }
+
+ if {$has_fork_catchpoints == 0} {
+ unsupported "fork catchpoints"
+ return -code return
+ }
+}
+
proc default_fork_parent_follow {} {
global gdb_prompt
@@ -116,7 +139,7 @@ proc explicit_fork_child_follow {} {
}
send_gdb "next 2\n"
gdb_expect {
- -re "Detaching from program:.*Attaching after fork to.*$gdb_prompt $"\
+ -re "Attaching after fork to.*$gdb_prompt $"\
{pass "explicit child follow, no catchpoints"}
-re "$gdb_prompt $" {fail "explicit child follow, no catchpoints"}
timeout {fail "(timeout) explicit child follow, no catchpoints"}
@@ -130,6 +153,7 @@ proc explicit_fork_child_follow {} {
proc catch_fork_child_follow {} {
global gdb_prompt
+ global srcfile
send_gdb "catch fork\n"
gdb_expect {
@@ -154,7 +178,7 @@ proc catch_fork_child_follow {} {
send_gdb "continue\n"
gdb_expect {
- -re "Catchpoint.*(forked process.*),.*in _fork_sys.*$gdb_prompt $"\
+ -re "Catchpoint.*(forked process.*),.*in .*fork.*$gdb_prompt $"\
{pass "explicit child follow, catch fork"}
-re "$gdb_prompt $" {fail "explicit child follow, catch fork"}
timeout {fail "(timeout) explicit child follow, catch fork"}
@@ -176,7 +200,7 @@ proc catch_fork_child_follow {} {
-re "$gdb_prompt $" {pass "set follow child"}
timeout {fail "(timeout) set follow child"}
}
- send_gdb "tbreak 24\n"
+ send_gdb "tbreak ${srcfile}:24\n"
gdb_expect {
-re "Breakpoint.*, line 24.*$gdb_prompt $"\
{pass "set follow child, tbreak"}
@@ -185,7 +209,7 @@ proc catch_fork_child_follow {} {
}
send_gdb "continue\n"
gdb_expect {
- -re ".*Detaching from program:.*Attaching after fork to.* at .*24.*$gdb_prompt $"\
+ -re "Attaching after fork to.* at .*24.*$gdb_prompt $"\
{pass "set follow child, hit tbreak"}
-re "$gdb_prompt $" {fail "set follow child, hit tbreak"}
timeout {fail "(timeout) set follow child, hit tbreak"}
@@ -212,6 +236,7 @@ proc catch_fork_child_follow {} {
proc tcatch_fork_parent_follow {} {
global gdb_prompt
+ global srcfile
send_gdb "catch fork\n"
gdb_expect {
@@ -226,7 +251,7 @@ proc tcatch_fork_parent_follow {} {
send_gdb "continue\n"
gdb_expect {
- -re ".*in _fork_sys.*$gdb_prompt $"\
+ -re ".*in .*fork.*$gdb_prompt $"\
{pass "explicit parent follow, tcatch fork"}
-re "$gdb_prompt $" {fail "explicit parent follow, tcatch fork"}
timeout {fail "(timeout) explicit parent follow, tcatch fork"}
@@ -236,7 +261,7 @@ proc tcatch_fork_parent_follow {} {
-re "$gdb_prompt $" {pass "set follow parent"}
timeout {fail "(timeout) set follow parent"}
}
- send_gdb "tbreak 24\n"
+ send_gdb "tbreak ${srcfile}:24\n"
gdb_expect {
-re "Breakpoint.*, line 24.*$gdb_prompt $"\
{pass "set follow parent, tbreak"}
@@ -314,6 +339,10 @@ By default, the debugger will follow the
timeout {fail "set follow to nonsense is prohibited (reset parent)"}
}
+ # Check that fork catchpoints are supported, as an indicator for whether
+ # fork-following is supported.
+ if [runto_main] then { check_fork_catchpoints }
+
# Test the default behaviour, which is to follow the parent of a
# fork, and detach from the child. Do this without catchpoints.
#
@@ -358,6 +387,9 @@ gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
+# The "Detaching..." and "Attaching..." messages may be hidden by
+# default.
+gdb_test "set verbose" ""
# This is a test of gdb's ability to follow the parent, child or both
# parent and child of a Unix fork() system call.
diff -up -u -X /home/jkratoch/.diffi.list -ruNp gdb-6.6-orig/gdb/testsuite/gdb.base/foll-vfork.exp gdb-6.6/gdb/testsuite/gdb.base/foll-vfork.exp
--- gdb-6.6-orig/gdb/testsuite/gdb.base/foll-vfork.exp 2006-08-10 07:27:20.000000000 +0200
+++ gdb-6.6/gdb/testsuite/gdb.base/foll-vfork.exp 2008-03-13 21:24:04.000000000 +0100
@@ -21,7 +21,7 @@ if $tracelevel then {
strace $tracelevel
}
-if { ![isnative] } then {
+if { [is_remote target] || ![isnative] } then {
continue
}
@@ -36,6 +36,7 @@ set bug_id 0
## return 0
##}
+global srcfile
set testfile "foll-vfork"
set testfile2 "vforked-prog"
set srcfile ${testfile}.c
@@ -57,7 +58,7 @@ if { [gdb_compile "${srcdir}/${subdir}/
# Until "set follow-fork-mode" and "catch vfork" are implemented on
# other targets...
#
-if ![istarget "hppa*-hp-hpux*"] then {
+if {![istarget "hppa*-hp-hpux*"] && ![istarget "*-linux*"]} then {
continue
}
@@ -74,6 +75,29 @@ if [istarget "hppa*-hp-hpux10.20"] then
set oldtimeout $timeout
set timeout [expr "$timeout + 10"]
+proc check_vfork_catchpoints {} {
+ global gdb_prompt
+ global has_vfork_catchpoints
+
+ # Verify that the system supports "catch vfork".
+ gdb_test "catch vfork" "Catchpoint \[0-9\]* \\(vfork\\)" "insert first vfork catchpoint"
+ set has_vfork_catchpoints 0
+ gdb_test_multiple "continue" "continue to first vfork catchpoint" {
+ -re ".*Your system does not support vfork catchpoints.*$gdb_prompt $" {
+ unsupported "continue to first vfork catchpoint"
+ }
+ -re ".*Catchpoint.*$gdb_prompt $" {
+ set has_vfork_catchpoints 1
+ pass "continue to first vfork catchpoint"
+ }
+ }
+
+ if {$has_vfork_catchpoints == 0} {
+ unsupported "vfork catchpoints"
+ return -code return
+ }
+}
+
proc vfork_parent_follow_through_step {} {
global gdb_prompt
@@ -98,20 +122,21 @@ proc vfork_parent_follow_through_step {}
proc vfork_parent_follow_to_bp {} {
global gdb_prompt
+ global srcfile
send_gdb "set follow parent\n"
gdb_expect {
-re "$gdb_prompt $" {pass "set follow parent, vfork to bp"}
timeout {fail "set follow parent, vfork to bp"}
}
- send_gdb "break 18\n"
+ send_gdb "break ${srcfile}:18\n"
gdb_expect {
-re "$gdb_prompt $" {pass "break, vfork to bp"}
timeout {fail "break, vfork to bp"}
}
send_gdb "continue\n"
gdb_expect {
- -re ".*Detaching after fork from process.*Breakpoint.*18.*$gdb_prompt "\
+ -re ".*Detaching after fork from child process.*Breakpoint.*18.*$gdb_prompt "\
{pass "vfork parent follow, to bp"}
-re "$gdb_prompt $" {fail "vfork parent follow, to bp"}
timeout {fail "(timeout) vfork parent follow, to bp" }
@@ -134,7 +159,7 @@ proc vfork_and_exec_child_follow_to_main
}
send_gdb "continue\n"
gdb_expect {
- -re "Detaching from program.*Attaching after fork to.*Executing new program.*Breakpoint.*vforked-prog.c:9.*$gdb_prompt "\
+ -re "Attaching after fork to.*Executing new program.*Breakpoint.*vforked-prog.c:9.*$gdb_prompt "\
{pass "vfork and exec child follow, to main bp"}
-re "$gdb_prompt $" {fail "vfork and exec child follow, to main bp"}
timeout {fail "(timeout) vfork and exec child follow, to main bp" }
@@ -192,7 +217,7 @@ proc vfork_and_exec_child_follow_through
}
send_gdb "next\n"
gdb_expect {
- -re "Detaching from program.*Attaching after fork to.*Executing new program.*Breakpoint.*vforked-prog.c:9.*$gdb_prompt "\
+ -re "Attaching after fork to.*Executing new program.*Breakpoint.*vforked-prog.c:9.*$gdb_prompt "\
{pass "vfork and exec child follow, through step"}
-re "$gdb_prompt $" {fail "vfork and exec child follow, through step"}
timeout {fail "(timeout) vfork and exec child follow, through step" }
@@ -249,7 +274,7 @@ proc tcatch_vfork_then_parent_follow {}
gdb_expect {
-re "0x\[0-9a-fA-F\]*.*vfork.*$gdb_prompt "\
{pass "vfork parent follow, tcatch vfork"}
- -re "0x\[0-9a-fA-F\]*.*_vfork.*$gdb_prompt "\
+ -re "vfork \\(\\) at.*$gdb_prompt "\
{pass "vfork parent follow, tcatch vfork"}
-re "$gdb_prompt $" {fail "vfork parent follow, tcatch vfork"}
timeout {fail "(timeout) vfork parent follow, tcatch vfork"}
@@ -270,6 +295,7 @@ proc tcatch_vfork_then_parent_follow {}
proc tcatch_vfork_then_child_follow {} {
global gdb_prompt
+ global srcfile
global srcfile2
send_gdb "set follow child\n"
@@ -288,6 +314,8 @@ proc tcatch_vfork_then_child_follow {} {
# HP-UX 10.20 seems to stop you in "vfork", while more recent HP-UXs
# stop you in "_vfork".
gdb_expect {
+ -re "vfork \\(\\) at .*$gdb_prompt $"\
+ {pass "vfork child follow, tcatch vfork"}
-re "0x\[0-9a-fA-F\]*.*vfork.*$gdb_prompt "\
{pass "vfork child follow, tcatch vfork"}
-re "0x\[0-9a-fA-F\]*.*_vfork.*$gdb_prompt "\
@@ -297,8 +325,10 @@ proc tcatch_vfork_then_child_follow {} {
}
send_gdb "finish\n"
gdb_expect {
- -re "Run till exit from.*vfork.*${srcfile2}:9.*$gdb_prompt "\
+ -re "Run till exit from.*vfork.*${srcfile}:12.*$gdb_prompt "\
{pass "vfork child follow, finish after tcatch vfork"}
+ -re "Run till exit from.*vfork.*${srcfile2}:9.*$gdb_prompt "\
+ {pass "vfork child follow, finish after tcatch vfork (followed exec)"}
-re "$gdb_prompt $" {fail "vfork child follow, finish after tcatch vfork"}
timeout {fail "(timeout) vfork child follow, finish after tcatch vfork" }
}
@@ -312,6 +342,10 @@ proc tcatch_vfork_then_child_follow {} {
proc do_vfork_and_exec_tests {} {
global gdb_prompt
+ # Check that vfork catchpoints are supported, as an indicator for whether
+ # vfork-following is supported.
+ if [runto_main] then { check_vfork_catchpoints }
+
# Try following the parent process by stepping through a call to
# vfork. Do this without catchpoints.
if [runto_main] then { vfork_parent_follow_through_step }
@@ -363,6 +397,9 @@ gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
+# The "Detaching..." and "Attaching..." messages may be hidden by
+# default.
+gdb_test "set verbose" ""
# This is a test of gdb's ability to follow the parent or child
# of a Unix vfork() system call. (The child will subsequently
Partial backport of:
2007-09-30 Daniel Jacobowitz <dan@codesourcery.com>
* linux-nat.c (linux_child_follow_fork): Set inferior_ptid to include
LWP ID. Use linux_nat_switch_fork.
--- gdb-6.6/gdb/linux-nat.c.orig 2008-03-11 21:31:37.000000000 +0100
+++ gdb-6.6/gdb/linux-nat.c 2008-03-11 21:30:25.000000000 +0100
@@ -550,12 +550,13 @@ child_follow_fork (struct target_ops *op
target_detach (NULL, 0);
}
- inferior_ptid = pid_to_ptid (child_pid);
+ inferior_ptid = ptid_build (child_pid, child_pid, 0);
/* Reinstall ourselves, since we might have been removed in
target_detach (which does other necessary cleanup). */
push_target (ops);
+ linux_nat_switch_fork (inferior_ptid);
/* Reset breakpoints in the child as appropriate. */
follow_inferior_reset_breakpoints ();

View File

@ -0,0 +1,107 @@
Fix i386-on-x86_64 debugging giving the warning:
warning: Lowest section in system-supplied DSO at 0xffffe000 is .hash at ffffe0b4
[ Backport for RH GDB-6.6. ]
--- gdb-6.6/gdb/symfile.c 2007-10-08 19:52:06.000000000 +0200
+++ gdb-6.6/gdb/symfile.c 2007-10-08 19:49:27.000000000 +0200
@@ -597,6 +597,37 @@ default_symfile_offsets (struct objfile
init_objfile_sect_indices (objfile);
}
+/* Find lowest loadable section to be used as starting point for continguous
+ sections. FIXME!! won't work without call to find .text first, but this
+ assumes text is lowest section. vDSO was seen for i386-on-amd64 processes
+ to have no `.text' as it has `.text.vsyscall', `.text.sigreturn' etc.
+ instead. Execution of this function has been delayed till it is really
+ needed as it is broken for vDSOs, fortunately it is never needed on
+ GNU/Linux. */
+
+static CORE_ADDR
+find_lower_offset (struct objfile *objfile)
+{
+ asection *lower_sect;
+
+ lower_sect = bfd_get_section_by_name (objfile->obfd, ".text");
+ if (lower_sect == NULL)
+ bfd_map_over_sections (objfile->obfd, find_lowest_section,
+ &lower_sect);
+ if (lower_sect == NULL)
+ warning (_("no loadable sections found in added symbol-file %s"),
+ objfile->name);
+ else
+ if ((bfd_get_section_flags (objfile->obfd, lower_sect) & SEC_CODE) == 0)
+ warning (_("Lowest section in %s is %s at %s"),
+ objfile->name,
+ bfd_section_name (objfile->obfd, lower_sect),
+ paddr (bfd_section_vma (objfile->obfd, lower_sect)));
+ if (lower_sect != NULL)
+ return bfd_section_vma (objfile->obfd, lower_sect);
+ else
+ return 0;
+}
/* Process a symbol file, as either the main file or as a dynamically
loaded file.
@@ -696,32 +727,11 @@ syms_from_objfile (struct objfile *objfi
happens for the PA64 port. */
if (/*!mainline &&*/ addrs && addrs->other[0].name)
{
- asection *lower_sect;
asection *sect;
- CORE_ADDR lower_offset;
+ CORE_ADDR lower_offset = 0; /* Shut up the GCC warning. */
+ int lower_offset_set = 0;
int i;
- /* Find lowest loadable section to be used as starting point for
- continguous sections. FIXME!! won't work without call to find
- .text first, but this assumes text is lowest section. */
- lower_sect = bfd_get_section_by_name (objfile->obfd, ".text");
- if (lower_sect == NULL)
- bfd_map_over_sections (objfile->obfd, find_lowest_section,
- &lower_sect);
- if (lower_sect == NULL)
- warning (_("no loadable sections found in added symbol-file %s"),
- objfile->name);
- else
- if ((bfd_get_section_flags (objfile->obfd, lower_sect) & SEC_CODE) == 0)
- warning (_("Lowest section in %s is %s at %s"),
- objfile->name,
- bfd_section_name (objfile->obfd, lower_sect),
- paddr (bfd_section_vma (objfile->obfd, lower_sect)));
- if (lower_sect != NULL)
- lower_offset = bfd_section_vma (objfile->obfd, lower_sect);
- else
- lower_offset = 0;
-
/* Calculate offsets for the loadable sections.
FIXME! Sections must be in order of increasing loadable section
so that contiguous sections can use the lower-offset!!!
@@ -743,6 +753,7 @@ syms_from_objfile (struct objfile *objfi
addrs->other[i].addr
-= bfd_section_vma (objfile->obfd, sect);
lower_offset = addrs->other[i].addr;
+ lower_offset_set = 1;
/* This is the index used by BFD. */
addrs->other[i].sectindex = sect->index ;
}
@@ -755,7 +766,17 @@ syms_from_objfile (struct objfile *objfi
}
}
else
- addrs->other[i].addr = lower_offset;
+ {
+ /* Delay finding LOWER_OFFSET only if it is needed. Otherwise
+ we would print a warning to detect a values never used. */
+ if (!lower_offset_set)
+ {
+ lower_offset = find_lower_offset (objfile);
+ lower_offset_set = 1;
+ }
+
+ addrs->other[i].addr = lower_offset;
+ }
}
}

View File

@ -0,0 +1,92 @@
2007-10-21 Luis Machado <luisgpm@br.ibm.com>
* rs6000-tdep.c (ppc_dwarf2_frame_init_reg): New function.
* (rs6000_gdbarch_init): Install ppc_dwarf2_frame_init_reg as
default dwarf2_frame_set_init_reg function.
===================================================================
RCS file: /cvs/src/src/gdb/rs6000-tdep.c,v
retrieving revision 1.292
retrieving revision 1.293
diff -u -r1.292 -r1.293
--- src/gdb/rs6000-tdep.c 2007/10/19 12:26:34 1.292
+++ src/gdb/rs6000-tdep.c 2007/10/21 20:04:47 1.293
@@ -2947,6 +2947,68 @@
return &rs6000_frame_base;
}
+/* DWARF-2 frame support. Used to handle the detection of
+ clobbered registers during function calls. */
+
+static void
+ppc_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum,
+ struct dwarf2_frame_state_reg *reg,
+ struct frame_info *next_frame)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+ /* PPC32 and PPC64 ABI's are the same regarding volatile and
+ non-volatile registers. We will use the same code for both. */
+
+ /* Call-saved GP registers. */
+ if ((regnum >= tdep->ppc_gp0_regnum + 14
+ && regnum <= tdep->ppc_gp0_regnum + 31)
+ || (regnum == tdep->ppc_gp0_regnum + 1))
+ reg->how = DWARF2_FRAME_REG_SAME_VALUE;
+
+ /* Call-clobbered GP registers. */
+ if ((regnum >= tdep->ppc_gp0_regnum + 3
+ && regnum <= tdep->ppc_gp0_regnum + 12)
+ || (regnum == tdep->ppc_gp0_regnum))
+ reg->how = DWARF2_FRAME_REG_UNDEFINED;
+
+ /* Deal with FP registers, if supported. */
+ if (tdep->ppc_fp0_regnum >= 0)
+ {
+ /* Call-saved FP registers. */
+ if ((regnum >= tdep->ppc_fp0_regnum + 14
+ && regnum <= tdep->ppc_fp0_regnum + 31))
+ reg->how = DWARF2_FRAME_REG_SAME_VALUE;
+
+ /* Call-clobbered FP registers. */
+ if ((regnum >= tdep->ppc_fp0_regnum
+ && regnum <= tdep->ppc_fp0_regnum + 13))
+ reg->how = DWARF2_FRAME_REG_UNDEFINED;
+ }
+
+ /* Deal with ALTIVEC registers, if supported. */
+ if (tdep->ppc_vr0_regnum > 0 && tdep->ppc_vrsave_regnum > 0)
+ {
+ /* Call-saved Altivec registers. */
+ if ((regnum >= tdep->ppc_vr0_regnum + 20
+ && regnum <= tdep->ppc_vr0_regnum + 31)
+ || regnum == tdep->ppc_vrsave_regnum)
+ reg->how = DWARF2_FRAME_REG_SAME_VALUE;
+
+ /* Call-clobbered Altivec registers. */
+ if ((regnum >= tdep->ppc_vr0_regnum
+ && regnum <= tdep->ppc_vr0_regnum + 19))
+ reg->how = DWARF2_FRAME_REG_UNDEFINED;
+ }
+
+ /* Handle PC register and Stack Pointer correctly. */
+ if (regnum == gdbarch_pc_regnum (current_gdbarch))
+ reg->how = DWARF2_FRAME_REG_RA;
+ else if (regnum == gdbarch_sp_regnum (current_gdbarch))
+ reg->how = DWARF2_FRAME_REG_CFA;
+}
+
+
/* Initialize the current architecture based on INFO. If possible, re-use an
architecture from ARCHES, which is a list of architectures already created
during this debugging session.
@@ -3410,6 +3472,9 @@
frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
dwarf2_frame_set_adjust_regnum (gdbarch, rs6000_adjust_frame_regnum);
+ /* Frame handling. */
+ dwarf2_frame_set_init_reg (gdbarch, ppc_dwarf2_frame_init_reg);
+
/* Hook in ABI-specific overrides, if they have been registered. */
gdbarch_init_osabi (info, gdbarch);

View File

@ -0,0 +1,103 @@
2007-11-04 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.arch/ppc-clobbered-registers-O2.exp: `powerpc64' changed to
`powerpc*'.
Testcase for:
http://sourceware.org/ml/gdb-patches/2007-09/msg00228.html
2007-10-21 Luis Machado <luisgpm@br.ibm.com>
* rs6000-tdep.c (ppc_dwarf2_frame_init_reg): New function.
* (rs6000_gdbarch_init): Install ppc_dwarf2_frame_init_reg as
default dwarf2_frame_set_init_reg function.
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.c 3 Nov 2007 22:22:28 -0000
@@ -0,0 +1,21 @@
+
+unsigned * __attribute__((noinline))
+start_sequence (unsigned * x, unsigned * y)
+{
+ return (unsigned *)0xdeadbeef;
+};
+
+unsigned __attribute__((noinline))
+gen_movsd (unsigned * operand0, unsigned * operand1)
+{
+ return *start_sequence(operand0, operand1);
+}
+
+int main(void)
+{
+ unsigned x, y;
+
+ x = 13;
+ y = 14;
+ return (int)gen_movsd (&x, &y);
+}
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.exp 3 Nov 2007 22:22:28 -0000
@@ -0,0 +1,61 @@
+# Copyright 2006 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.
+#
+# This file is part of the gdb testsuite.
+
+if $tracelevel {
+ strace $tracelevel
+}
+
+# Test displaying call clobbered registers in optimized binaries for ppc.
+# GDB should not show incorrect values.
+
+set prms_id 0
+set bug_id 0
+
+if ![istarget "powerpc*-*"] then {
+ verbose "Skipping powerpc* call clobbered registers testing."
+ return
+}
+
+set testfile "ppc-clobbered-registers-O2"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+set compile_flags "debug additional_flags=-O2"
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable ${compile_flags}] != "" } {
+ unsupported "Testcase compile failed."
+ return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+if ![runto_main] then {
+ perror "Couldn't run to breakpoint"
+ continue
+}
+
+gdb_test "b start_sequence" ".*Breakpoint 2 at.*line 6.*" \
+ "Insert breakpoint at problematic function"
+
+gdb_test continue ".*Breakpoint 2.*in start_sequence.*" \
+ "Run until problematic function"
+
+gdb_test backtrace ".*operand0=<value optimized out>.*operand1=<value optimized out>.*" \
+ "Check value of call clobbered registers"

View File

@ -0,0 +1,329 @@
2007-01-03 Daniel Jacobowitz <dan@codesourcery.com>
* gdb.threads/tls.exp: Allow stops in sem_post.
--- src/gdb/testsuite/gdb.threads/tls.exp 2003/07/29 21:51:25 1.4
+++ src/gdb/testsuite/gdb.threads/tls.exp 2007/01/03 17:30:18 1.5
@@ -246,7 +246,11 @@
incr thrs_in_spin
select_thread $i
set level $spin_threads_level($i)
- gdb_test "up $level" ".*spin.*sem_wait.*" "thread $i up"
+ # We expect to be in sem_wait, but if the thread has not yet
+ # been scheduled, we might be in sem_post still. We could be at
+ # any intermediate point in spin, too, but that is much less
+ # likely.
+ gdb_test "up $level" ".*spin.*sem_(wait|post).*" "thread $i up"
check_thread_local $i
}
}
2007-01-26 Andreas Schwab <schwab@suse.de>
* gdb.base/multi-forks.exp ("restart $i"): Also match
__kernel_syscall_via_break.
[ Present in the gdb-6.6 upstream sources although missing in ChangeLog. ]
2007-07-27 Daniel Jacobowitz <dan@codesourcery.com>
* gdb.base/readline.exp (operate_and_get_next): Match the final
prompt.
--- ./gdb/testsuite/gdb.base/readline.exp 3 Jan 2007 21:46:12 -0000 1.3
+++ ./gdb/testsuite/gdb.base/readline.exp 27 Jul 2007 15:15:02 -0000 1.4
@@ -139,6 +139,9 @@ proc operate_and_get_next {name args} {
set count [expr {$count + 2}]
}
+ # Match the prompt so the next test starts at the right place.
+ gdb_test "" "" "$name - final prompt"
+
return 1
}
2007-09-17 Daniel Jacobowitz <dan@codesourcery.com>
* schedlock.c (NUM): Change to 1.
(main): Use args[0] for the main thread.
* schedlock.exp: Only expect two threads. Only issue one pass or fail
regardless of the number of threads.
--- ./gdb/testsuite/gdb.threads/schedlock.exp 23 Aug 2007 18:14:19 -0000 1.6
+++ ./gdb/testsuite/gdb.threads/schedlock.exp 17 Sep 2007 15:38:05 -0000 1.7
@@ -32,6 +32,9 @@ set testfile "schedlock"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
+# The number of threads, including the main thread.
+set NUM 2
+
if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } {
return -1
}
@@ -44,11 +47,11 @@ proc get_args { } {
send_gdb "print args\n"
gdb_expect {
- -re "\\\$\[0-9\]+ = {(\[0-9\]+), (\[0-9\]+), (\[0-9\]+), (\[0-9\]+), (\[0-9\]+), (\[0-9\]+)}.*$gdb_prompt"
+ -re "\\\$\[0-9\]+ = {(\[0-9\]+), (\[0-9\]+)}.*$gdb_prompt"
{
set list_count [expr $list_count + 1]
pass "listed args ($list_count)"
- return [list $expect_out(1,string) $expect_out(2,string) $expect_out(3,string) $expect_out(4,string) $expect_out(5,string) $expect_out(6,string)]
+ return [list $expect_out(1,string) $expect_out(2,string)]
}
-re "$gdb_prompt"
{
@@ -112,7 +115,7 @@ proc my_continue { msg } {
stop_process "stop all threads ($msg)"
# Make sure we're in one of the non-main looping threads.
- gdb_breakpoint [concat [gdb_get_line_number "schedlock.exp: main loop"] " if arg != 5"]
+ gdb_breakpoint [concat [gdb_get_line_number "schedlock.exp: main loop"] " if arg != 0"]
gdb_continue_to_breakpoint "return to loop ($msg)"
delete_breakpoints
}
@@ -198,13 +201,17 @@ my_continue "initial"
set cont_args [get_args]
-for {set i 0} {[expr $i < 6]} {set i [expr $i + 1]} {
+set ok 1
+for {set i 0} {[expr $i < $NUM]} {set i [expr $i + 1]} {
if {[lindex $start_args $i] == [lindex $cont_args $i]} {
- fail "thread $i ran (didn't run)"
- } else {
- pass "thread $i ran"
+ set ok 0
}
}
+if { $ok } {
+ pass "all threads alive"
+} else {
+ fail "all threads alive"
+}
# We can't change threads, unfortunately, in current GDB. Use
# whichever we stopped in.
@@ -230,7 +237,7 @@ set start_args $cont_args
set cont_args [get_args]
set num_other_threads 0
-for {set i 0} {[expr $i < 6]} {set i [expr $i + 1]} {
+for {set i 0} {[expr $i < $NUM]} {set i [expr $i + 1]} {
if {[lindex $start_args $i] == [lindex $cont_args $i]} {
if {$i == $curthread} {
fail "current thread stepped (didn't run)"
@@ -248,9 +255,9 @@ for {set i 0} {[expr $i < 6]} {set i [ex
}
}
if {$num_other_threads > 0} {
- pass "other threads ran (1)"
+ pass "other threads ran - unlocked"
} else {
- fail "other threads ran (no other threads ran) (1)"
+ fail "other threads ran - unlocked"
}
# Test continue with scheduler locking
@@ -269,21 +276,25 @@ if {$curthread == $newthread} {
set start_args $cont_args
set cont_args [get_args]
-for {set i 0} {[expr $i < 6]} {set i [expr $i + 1]} {
+set num_other_threads 0
+for {set i 0} {[expr $i < $NUM]} {set i [expr $i + 1]} {
if {[lindex $start_args $i] == [lindex $cont_args $i]} {
if {$i == $curthread} {
fail "current thread ran (didn't run)"
- } else {
- pass "other thread $i didn't run"
}
} else {
if {$i == $curthread} {
pass "current thread ran"
} else {
- fail "other thread $i didn't run (ran)"
+ incr num_other_threads
}
}
}
+if {$num_other_threads > 0} {
+ fail "other threads didn't run - locked"
+} else {
+ pass "other threads didn't run - locked"
+}
# Test stepping with scheduler locking
step_ten_loops "locked"
@@ -299,12 +310,11 @@ if {$curthread == $newthread} {
set start_args $cont_args
set cont_args [get_args]
-for {set i 0} {[expr $i < 6]} {set i [expr $i + 1]} {
+set num_other_threads 0
+for {set i 0} {[expr $i < $NUM]} {set i [expr $i + 1]} {
if {[lindex $start_args $i] == [lindex $cont_args $i]} {
if {$i == $curthread} {
fail "current thread stepped locked (didn't run)"
- } else {
- pass "other thread $i didn't run (stepping)"
}
} else {
if {$i == $curthread} {
@@ -314,9 +324,14 @@ for {set i 0} {[expr $i < 6]} {set i [ex
fail "current thread stepped locked (wrong amount)"
}
} else {
- fail "other thread $i didn't run (stepping) (ran)"
+ incr num_other_threads
}
}
}
+if {$num_other_threads > 0} {
+ fail "other threads didn't run - step locked"
+} else {
+ pass "other threads didn't run - step locked"
+}
return 0
--- ./gdb/testsuite/gdb.threads/schedlock.c 23 Aug 2007 18:08:50 -0000 1.7
+++ ./gdb/testsuite/gdb.threads/schedlock.c 17 Sep 2007 15:38:05 -0000 1.8
@@ -22,7 +22,7 @@
void *thread_function(void *arg); /* Pointer to function executed by each thread */
-#define NUM 5
+#define NUM 1
unsigned int args[NUM+1];
@@ -32,7 +32,7 @@ int main() {
void *thread_result;
long i;
- for (i = 0; i < NUM; i++)
+ for (i = 1; i <= NUM; i++)
{
args[i] = 1;
res = pthread_create(&threads[i],
@@ -42,8 +42,8 @@ int main() {
}
/* schedlock.exp: last thread start. */
- args[i] = 1;
- thread_function ((void *) i);
+ args[0] = 1;
+ thread_function ((void *) 0);
exit(EXIT_SUCCESS);
}
2007-12-08 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/fileio.c (ROOTSUBDIR): New macro.
(main): CHDIR into ROOTSUBDIR. CHOWN ROOTSUBDIR and CHDIR into
ROOTSUBDIR if we are being run as root.
* gdb.base/fileio.exp: Change the startup and finish cleanup.
Change the test file reference to be into the `fileio.dir' directory.
--- ./gdb/testsuite/gdb.base/fileio.c 13 Jun 2006 08:55:22 -0000 1.10
+++ ./gdb/testsuite/gdb.base/fileio.c 8 Dec 2007 16:04:10 -0000
@@ -58,6 +58,8 @@ system (const char * string);
1) Invalid string/command. - returns 127. */
static const char *strerrno (int err);
+#define ROOTSUBDIR "fileio.dir"
+
#define FILENAME "foo.fileio.test"
#define RENAMED "bar.fileio.test"
#define NONEXISTANT "nofoo.fileio.test"
@@ -542,6 +544,37 @@ strerrno (int err)
int
main ()
{
+ /* ROOTSUBDIR is already prepared by fileio.exp. We use it for easy cleanup
+ (by fileio.exp) if we are run by multiple users in the same directory. */
+
+ if (chdir (ROOTSUBDIR) != 0)
+ {
+ printf ("chdir " ROOTSUBDIR ": %s\n", strerror (errno));
+ exit (1);
+ }
+
+ /* These tests
+ Open for write but no write permission returns EACCES
+ Unlinking a file in a directory w/o write access returns EACCES
+ fail if we are being run as root - drop the privileges here. */
+
+ if (geteuid () == 0)
+ {
+ uid_t uid = 99;
+
+ if (chown (".", uid, uid) != 0)
+ {
+ printf ("chown %d.%d " ROOTSUBDIR ": %s\n", (int) uid, (int) uid,
+ strerror (errno));
+ exit (1);
+ }
+ if (setuid (uid) || geteuid () == 0)
+ {
+ printf ("setuid %d: %s\n", (int) uid, strerror (errno));
+ exit (1);
+ }
+ }
+
/* Don't change the order of the calls. They partly depend on each other */
test_open ();
test_write ();
--- ./gdb/testsuite/gdb.base/fileio.exp 23 Aug 2007 18:14:16 -0000 1.12
+++ ./gdb/testsuite/gdb.base/fileio.exp 8 Dec 2007 16:04:10 -0000
@@ -46,8 +46,8 @@ if [get_compiler_info ${binfile}] {
return -1;
}
-remote_exec build {sh -xc test\ -r\ dir2.fileio.test\ &&\ chmod\ -f\ +w\ dir2.fileio.test}
-remote_exec build {sh -xc rm\ -rf\ *.fileio.test}
+remote_exec build {sh -xc rm\ -rf\ fileio.dir}
+remote_exec build {sh -xc mkdir\ -m777\ fileio.dir}
set oldtimeout $timeout
set timeout [expr "$timeout + 60"]
@@ -88,7 +88,7 @@ gdb_test continue \
"Opening nonexistant file returns ENOENT"
send_gdb "continue\n" ; gdb_expect -re "$gdb_prompt $"
-catch "system \"chmod -f -w nowrt.fileio.test\""
+catch "system \"chmod -f -w fileio.dir/nowrt.fileio.test\""
gdb_test continue \
"Continuing\\..*open 5:.*EACCES$stop_msg" \
@@ -252,8 +252,8 @@ gdb_test continue \
send_gdb "quit\n"
send_gdb "y\n"
-remote_exec build {sh -xc test\ -r\ dir2.fileio.test\ &&\ chmod\ -f\ +w\ dir2.fileio.test}
-remote_exec build {sh -xc rm\ -rf\ *.fileio.test}
+remote_exec build {sh -xc test\ -r\ fileio.dir/dir2.fileio.test\ &&\ chmod\ -f\ +w\ fileio.dir/dir2.fileio.test}
+remote_exec build {sh -xc rm\ -rf\ fileio.dir}
set timeout $oldtimeout
return 0
2007-12-10 Jan Kratochvil <jan.kratochvil@redhat.com>
* lib/gdb.exp (build_id_debug_filename_get): OBJCOPY pipe being read
must be set to binary.
--- ./gdb/testsuite/lib/gdb.exp 9 Dec 2007 11:21:21 -0000 1.93
+++ ./gdb/testsuite/lib/gdb.exp 10 Dec 2007 00:14:55 -0000
@@ -2500,6 +2500,7 @@ proc build_id_debug_filename_get { exec
return ""
}
set fi [open $tmp]
+ fconfigure $fi -translation binary
# Skip the NOTE header.
read $fi 16
set data [read $fi]

100
gdb.spec
View File

@ -11,7 +11,7 @@ Name: gdb
Version: 6.6
# The release always contains a leading reserved number, start it at 1.
Release: 31%{?dist}
Release: 45%{?dist}
License: GPL
Group: Development/Debuggers
@ -229,7 +229,6 @@ Patch190: gdb-6.5-dwarf-stack-overflow.patch
Patch191: gdb-6.5-bz205551-printf-p.patch
# Support TLS symbols (+`errno' suggestion if no pthread is found) (BZ 185337).
# FIXME: Still to be updated.
Patch194: gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch
# Fix TLS symbols resolving for objects with separate .debug file (-debuginfo).
@ -299,6 +298,7 @@ Patch231: gdb-6.3-bz202689-exec-from-pthread-test.patch
# Backported post gdb-6.6 release fixups.
Patch232: gdb-6.6-upstream.patch
Patch307: gdb-6.6-upstream2.patch
# Testcase for PPC Power6/DFP instructions disassembly (BZ 230000).
Patch234: gdb-6.6-bz230000-power6-disassembly-test.patch
@ -331,7 +331,7 @@ Patch245: gdb-6.6-bz229517-gcore-without-terminal.patch
Patch246: gdb-6.6-bz237096-watchthreads-testcasefix.patch
# Notify user of a child forked process being detached (BZ 235197).
Patch247: gdb-6.6-bz234468-fork-detach-info.patch
Patch247: gdb-6.6-bz235197-fork-detach-info.patch
# Fix `gcore' command for 32bit PPC inferiors on 64bit PPC hosts (BZ 232015).
Patch248: gdb-6.6-bz232015-gcore-ppc-on-ppc64.patch
@ -374,13 +374,38 @@ Patch272: gdb-6.6-glibc-open-fcntl2-compat.patch
Patch273: gdb-6.6-buildid-verify.patch
Patch274: gdb-6.6-buildid-locate.patch
# Fixed the kernel VDSO loading (producing `no loadable sections found').
# Fixed the kernel 8KB VDSO loading (producing `no loadable sections found').
Patch276: gdb-6.6-bfd-vdso8k.patch
# Fixed the kernel i386-on-x86_64 VDSO loading (producing `Lowest section in').
Patch277: gdb-6.6-vdso-i386-on-amd64-warning.patch
# Fix debug load for sparse assembler files (such as vDSO32 for i386-on-x86_64).
Patch278: gdb-6.6-cu-ranges.patch
# Fix hardware watchpoints after inferior forks-off some process.
Patch280: gdb-6.6-multifork-debugreg-for-i386-and-x86_64.patch
# Fix PPC hiding of call-volatile parameter register.
Patch285: gdb-6.7-ppc-clobbered-registers-O2-fix.patch
Patch284: gdb-6.7-ppc-clobbered-registers-O2-test.patch
# Testsuite fixes for more stable/comparable results.
Patch287: gdb-6.7-testsuite-stable-results.patch
# Fix (backport) PPC biarch (ppc64->ppc) addresses above 2GB (BZ 426613).
Patch291: gdb-6.6-bz426613-ppc-biarch-signed-addresses-fix.patch
# Fix+test (backport) threading of statically linked inferiors (BZ 314131).
# - It requires recent glibc to work in this case properly.
Patch298: gdb-6.6-threads-static-test.patch
BuildRequires: ncurses-devel glibc-devel gcc make gzip texinfo dejagnu gettext
BuildRequires: flex bison sharutils expat-devel
Requires: readline
BuildRequires: readline-devel
Requires: rpm-libs
BuildRequires: rpm-devel
%define multilib_64_archs sparc64 ppc64 s390x x86_64
%ifarch %{multilib_64_archs} sparc ppc
@ -533,6 +558,15 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
%patch273 -p1
%patch274 -p1
%patch276 -p1
%patch277 -p1
%patch278 -p1
%patch280 -p1
%patch284 -p1
%patch285 -p1
%patch287 -p1
%patch291 -p1
%patch298 -p1
%patch307 -p1
# Change the version that gets printed at GDB startup, so it is RedHat
# specific.
@ -689,6 +723,64 @@ fi
# don't include the files in include, they are part of binutils
%changelog
* Thu Mar 13 2008 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.6-45
- Backport of follow-fork-mode child fixes (BZ 435819).
* Mon Mar 10 2008 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.6-44
- build-id warnings integrated more with rpm and the lists of the warnings got
replaced usually by a single-line `debuginfo-install' advice (BZ 435581).
- FIXME: Testsuite needs an update for the new pre-prompt messages.
* Thu Feb 21 2008 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.6-43
- Rename `set debug build-id' as `set build-id-verbose', former level 1 moved
to level 2, default value is now 1, use `set build-id-verbose 0' now to
disable the missing separate debug filenames messages (BZ 432164).
* Thu Jan 24 2008 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.6-42
- build-id debug messages print now the library names unconditionally.
* Thu Jan 24 2008 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.6-41
- Improve the text UI messages for the build-id debug files locating.
- Require now the rpm libraries.
* Thu Jan 10 2008 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.6-40
- Fix+test (backport) threading of statically linked inferiors (BZ 314131).
- It requires recent glibc to work in this case properly.
* Thu Dec 27 2007 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.6-39
- Fix (backport) PPC biarch (ppc64->ppc) addresses above 2GB (BZ 426613).
- Fix the vendora testcase `attach-32.exp' affecting the other tests results.
* Sat Dec 22 2007 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.6-38
- Fix crash on parsing duplicite file entries debug info (BZ 426395).
- Fix (#2) readline history for input mode commands like `command' (BZ 215816).
- Fix documentation on hardware watchpoints wrt multiple threads.
- Rename the patch file for BZ 235197 from its former name BZ 234468.
* Mon Dec 10 2007 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.6-37
- Testsuite fixes for more stable/comparable results.
* Thu Nov 8 2007 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.6-36
- Fix `errno' resolving on glibc with broken DW_AT_MIPS_linkage_name.
- Imported 6.7 PPC hiding of call-volatile parameter registers.
* Fri Oct 19 2007 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.6-35
- Fix hiding unexpected breakpoints on intentional step/next commands.
- Fix s390 compilation warning/failure due to a wrongly sized type-cast.
* Sun Oct 14 2007 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.6-34
- Set the breakpoints always to all the ctors/dtors variants (BZ 301701).
- Fix non-threaded watchpoints CTRL-C regression on `set follow child'.
- Fix hardware watchpoints after inferior forks-off some process.
* Thu Oct 11 2007 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.6-33
- Fix gdbserver for threaded applications and recent glibc (BZ 328021).
* Wed Oct 10 2007 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.6-32
- Fix debug load for sparse assembler files (such as vDSO32 for i386-on-x86_64).
- Fix a TUI visual corruption due to the build-id warnings (BZ 320061).
- Fixed the kernel i386-on-x86_64 VDSO loading (producing `Lowest section in').
* Fri Oct 5 2007 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.6-31
- Fix address changes of the ctors/dtors breakpoints w/multiple PCs (BZ 301701).
- Delete an info doc file on `rpmbuild -bp' later rebuilt during `rpmbuild -bc'.