- Fix non-threaded watchpoints CTRL-C regression on `set follow child'.

This commit is contained in:
Jan Kratochvil 2007-10-13 18:40:40 +00:00
parent 84f82bf43b
commit bd518c30d9
2 changed files with 113 additions and 4 deletions

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

@ -11,7 +11,7 @@ Name: gdb
Version: 6.6
# The release always contains a leading reserved number, start it at 1.
Release: 34%{?dist}
Release: 35%{?dist}
License: GPL
Group: Development/Debuggers
@ -697,6 +697,9 @@ fi
# don't include the files in include, they are part of binutils
%changelog
* Fri Oct 13 2007 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.6-35
- Fix non-threaded watchpoints CTRL-C regression on `set follow child'.
* Fri Oct 12 2007 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.6-34
- Fix gdbserver for threaded applications and recent glibc (BZ 328021).