This is the mail archive of the archer-commits@sourceware.org mailing list for the Archer project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[SCM] master: Merge remote branch 'gdb/master'


The branch, master has been updated
       via  2d552d549a3db77bfe291cde268c48d3a942d5d6 (commit)
       via  5e291547568309c89b995cf7dfee2f8dbe69ae4a (commit)
       via  b0793d2e9127adb8b630d1a2b93259a42d8a0e3c (commit)
       via  615f724ac9d6abbd049958f2e8f7ff4ad0201102 (commit)
       via  a561b6628081120fdec5425e4f92520e12f01ace (commit)
       via  57525cd906fac970697843c95a200728cd1dd3a5 (commit)
       via  3ebd22671e746bdcf6777449263cebad1984a4e9 (commit)
       via  522c6b2924ae5291fcd964ae9ca0679ae0777c1c (commit)
      from  d7fcfd6be145834cdadae42ecde52a62266d4784 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit 2d552d549a3db77bfe291cde268c48d3a942d5d6
Merge: d7fcfd6be145834cdadae42ecde52a62266d4784 5e291547568309c89b995cf7dfee2f8dbe69ae4a
Author: Jan Kratochvil <jkratoch@host1.dyn.jankratochvil.net>
Date:   Mon Nov 16 03:22:02 2009 +0100

    Merge remote branch 'gdb/master'

commit 5e291547568309c89b995cf7dfee2f8dbe69ae4a
Author: gdbadmin <gdbadmin@sourceware.org>
Date:   Mon Nov 16 00:00:03 2009 +0000

    *** empty log message ***

commit b0793d2e9127adb8b630d1a2b93259a42d8a0e3c
Author: Alan Modra <amodra@bigpond.net.au>
Date:   Sun Nov 15 23:00:05 2009 +0000

    daily update

commit 615f724ac9d6abbd049958f2e8f7ff4ad0201102
Author: Pedro Alves <pedro@codesourcery.com>
Date:   Sun Nov 15 20:13:58 2009 +0000

    	* gdb.base/watch-vfork.c, gdb.base/watch-vfork.exp: New files.

commit a561b6628081120fdec5425e4f92520e12f01ace
Author: Pedro Alves <pedro@codesourcery.com>
Date:   Sun Nov 15 20:10:34 2009 +0000

    	* infrun.c (handle_inferior_event): When handling a fork or vfork
    	event, check if the bpstat causes a stop, instead of if it
    	explains the signal.
    	* breakpoint.c (bpstat_causes_stop): New.
    	* breakpoint.h (bpstat_causes_stop): Declare.

commit 57525cd906fac970697843c95a200728cd1dd3a5
Author: Pedro Alves <pedro@codesourcery.com>
Date:   Sun Nov 15 20:07:57 2009 +0000

    	* breakpoint.c (should_be_inserted): Don't insert breakpoints if
    	the pspace doesn't allow breakpoints.
    	(insert_breakpoint_locations): Remove waiting_for_vfork_done
    	special case.  Expect watchpoints that shouldn't be inserted, to
    	not be inserted.
    	* progspace.h (struct program_space) <breakpoints_not_allowed>:
    	New field.
    	* infrun.c (handle_inferior_event): Clear it.
    	* linux-nat.c (linux_child_follow_fork): Set it.

commit 3ebd22671e746bdcf6777449263cebad1984a4e9
Author: gdbadmin <gdbadmin@sourceware.org>
Date:   Sun Nov 15 00:00:03 2009 +0000

    *** empty log message ***

commit 522c6b2924ae5291fcd964ae9ca0679ae0777c1c
Author: Alan Modra <amodra@bigpond.net.au>
Date:   Sat Nov 14 23:00:04 2009 +0000

    daily update

-----------------------------------------------------------------------

Summary of changes:
 bfd/version.h                          |    2 +-
 gdb/ChangeLog                          |   20 ++++++++++++
 gdb/breakpoint.c                       |   42 +++++++++++++------------
 gdb/breakpoint.h                       |    3 ++
 gdb/infrun.c                           |    7 ++++-
 gdb/linux-nat.c                        |    1 +
 gdb/progspace.h                        |    4 ++
 gdb/testsuite/ChangeLog                |    4 ++
 gdb/testsuite/gdb.base/watch-vfork.c   |   41 +++++++++++++++++++++++++
 gdb/testsuite/gdb.base/watch-vfork.exp |   52 ++++++++++++++++++++++++++++++++
 gdb/version.in                         |    2 +-
 11 files changed, 155 insertions(+), 23 deletions(-)
 create mode 100644 gdb/testsuite/gdb.base/watch-vfork.c
 create mode 100644 gdb/testsuite/gdb.base/watch-vfork.exp

First 500 lines of diff:
diff --git a/bfd/version.h b/bfd/version.h
index 7f5bcb9..cd2a903 100644
--- a/bfd/version.h
+++ b/bfd/version.h
@@ -1,4 +1,4 @@
-#define BFD_VERSION_DATE 20091114
+#define BFD_VERSION_DATE 20091116
 #define BFD_VERSION @bfd_version@
 #define BFD_VERSION_STRING  @bfd_version_package@ @bfd_version_string@
 #define REPORT_BUGS_TO @report_bugs_to@
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 7769fff..93fdd8c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,23 @@
+2009-11-15  Pedro Alves  <pedro@codesourcery.com>
+
+	* infrun.c (handle_inferior_event): When handling a fork or vfork
+	event, check if the bpstat causes a stop, instead of if it
+	explains the signal.
+	* breakpoint.c (bpstat_causes_stop): New.
+	* breakpoint.h (bpstat_causes_stop): Declare.
+
+2009-11-15  Pedro Alves  <pedro@codesourcery.com>
+
+	* breakpoint.c (should_be_inserted): Don't insert breakpoints if
+	the pspace doesn't allow breakpoints.
+	(insert_breakpoint_locations): Remove waiting_for_vfork_done
+	special case.  Expect watchpoints that shouldn't be inserted, to
+	not be inserted.
+	* progspace.h (struct program_space) <breakpoints_not_allowed>:
+	New field.
+	* infrun.c (handle_inferior_event): Clear it.
+	* linux-nat.c (linux_child_follow_fork): Set it.
+
 2009-11-13  Doug Evans  <dje@google.com>
 
 	* dcache.c (dcache_hit, dcache_read_line): Tweak comments.
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index cadc536..c6140b0 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -1193,6 +1193,17 @@ should_be_inserted (struct bp_location *bpt)
   if (!bpt->enabled || bpt->shlib_disabled || bpt->duplicate)
     return 0;
 
+  /* This is set for example, when we're attached to the parent of a
+     vfork, and have detached from the child.  The child is running
+     free, and we expect it to do an exec or exit, at which point the
+     OS makes the parent schedulable again (and the target reports
+     that the vfork is done).  Until the child is done with the shared
+     memory region, do not insert breakpoints in the parent, otherwise
+     the child could still trip on the parent's breakpoints.  Since
+     the parent is blocked anyway, it won't miss any breakpoint.  */
+  if (bpt->pspace->breakpoints_not_allowed)
+    return 0;
+
   /* Tracepoints are inserted by the target at a time of its choosing,
      not by us.  */
   if (bpt->owner->type == bp_tracepoint)
@@ -1530,25 +1541,6 @@ insert_breakpoint_locations (void)
 	  && ptid_equal (inferior_ptid, null_ptid))
 	continue;
 
-      if (!ptid_equal (inferior_ptid, null_ptid))
-	{
-	  struct inferior *inf = current_inferior ();
-	  if (inf->waiting_for_vfork_done)
-	    {
-	      /* This is set when we're attached to the parent of the
-		 vfork, and have detached from the child.  The child
-		 is running free, and we expect it to do an exec or
-		 exit, at which point the OS makes the parent
-		 schedulable again (and the target reports that the
-		 vfork is done).  Until the child is done with the
-		 shared memory region, do not insert breakpoints in
-		 parent, otherwise the child could still trip on the
-		 parent's breakpoints.  Since the parent is blocked
-		 anyway, it won't miss any breakpoint.  */
-	      continue;
-	    }
-	}
-
       val = insert_bp_location (b, tmp_error_stream,
 				    &disabled_breaks,
 				    &hw_breakpoint_error);
@@ -1573,7 +1565,7 @@ insert_breakpoint_locations (void)
 	continue;
       
       for (loc = bpt->loc; loc; loc = loc->next)
-	if (!loc->inserted)
+	if (!loc->inserted && should_be_inserted (loc))
 	  {
 	    some_failed = 1;
 	    break;
@@ -3824,6 +3816,16 @@ bpstat_should_step (void)
   return 0;
 }
 
+int
+bpstat_causes_stop (bpstat bs)
+{
+  for (; bs != NULL; bs = bs->next)
+    if (bs->stop)
+      return 1;
+
+  return 0;
+}
+
 
 
 static void print_breakpoint_location (struct breakpoint *b,
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index d23a852..91e864c 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -629,6 +629,9 @@ extern struct breakpoint *bpstat_find_step_resume_breakpoint (bpstat);
    a watchpoint enabled.  */
 #define bpstat_explains_signal(bs) ((bs) != NULL)
 
+/* Nonzero is this bpstat causes a stop.  */
+extern int bpstat_causes_stop (bpstat);
+
 /* Nonzero if we should step constantly (e.g. watchpoints on machines
    without hardware support).  This isn't related to a specific bpstat,
    just to things like whether watchpoints are set.  */
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 9d8ab68..98e215c 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -2946,7 +2946,11 @@ handle_inferior_event (struct execution_control_state *ecs)
 	= bpstat_stop_status (get_regcache_aspace (get_current_regcache ()),
 			      stop_pc, ecs->ptid);
 
-      ecs->random_signal = !bpstat_explains_signal (ecs->event_thread->stop_bpstat);
+      /* Note that we're interested in knowing the bpstat actually
+	 causes a stop, not just if it may explain the signal.
+	 Software watchpoints, for example, always appear in the
+	 bpstat.  */
+      ecs->random_signal = !bpstat_causes_stop (ecs->event_thread->stop_bpstat);
 
       /* If no catchpoint triggered for this, then keep going.  */
       if (ecs->random_signal)
@@ -3004,6 +3008,7 @@ handle_inferior_event (struct execution_control_state *ecs)
 	context_switch (ecs->ptid);
 
       current_inferior ()->waiting_for_vfork_done = 0;
+      current_inferior ()->pspace->breakpoints_not_allowed = 0;
       /* This also takes care of reinserting breakpoints in the
 	 previously locked inferior.  */
       keep_going (ecs);
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index c0c0240..95feca6 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -793,6 +793,7 @@ holding the child stopped.  Try \"set detach-on-fork\" or \
 	     subsequent child exec or exit is enough to know when does
 	     the child stops using the parent's address space.  */
 	  parent_inf->waiting_for_vfork_done = detach_fork;
+	  parent_inf->pspace->breakpoints_not_allowed = detach_fork;
 
 	  lp = find_lwp_pid (pid_to_ptid (parent_pid));
 	  gdb_assert (linux_supports_tracefork_flag >= 0);
diff --git a/gdb/progspace.h b/gdb/progspace.h
index 0cf1382..4d87d16 100644
--- a/gdb/progspace.h
+++ b/gdb/progspace.h
@@ -165,6 +165,10 @@ struct program_space
        to set breakpoints point at the wrong addresses.  */
     int executing_startup;
 
+    /* True if no breakpoints should be inserted in this program
+       space.  */
+    int breakpoints_not_allowed;
+
     /* The object file that the main symbol table was loaded from
        (e.g. the argument to the "symbol-file" or "file" command).  */
     struct objfile *symfile_object_file;
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index fefd628..64eb802 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2009-11-15  Pedro Alves  <pedro@codesourcery.com>
+
+	* gdb.base/watch-vfork.c, gdb.base/watch-vfork.exp: New files.
+
 2009-11-13  Daniel Jacobowitz  <dan@codesourcery.com>
 
 	* lib/gdb.exp (current_target_name): New procedure.
diff --git a/gdb/testsuite/gdb.base/watch-vfork.c b/gdb/testsuite/gdb.base/watch-vfork.c
new file mode 100644
index 0000000..a72be3d
--- /dev/null
+++ b/gdb/testsuite/gdb.base/watch-vfork.c
@@ -0,0 +1,41 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+   Copyright 2009 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include <unistd.h>
+
+int *global;
+
+int
+main (void)
+{
+  int pid;
+
+  pid = vfork ();
+  if (pid == -1)
+    {
+      return 1;
+    }
+  else if (pid != 0)
+    {
+      global = &pid;
+    }
+  else
+    {
+      _exit (0);
+    }
+  return 0;
+}
diff --git a/gdb/testsuite/gdb.base/watch-vfork.exp b/gdb/testsuite/gdb.base/watch-vfork.exp
new file mode 100644
index 0000000..940af99
--- /dev/null
+++ b/gdb/testsuite/gdb.base/watch-vfork.exp
@@ -0,0 +1,52 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2009 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+global srcfile
+set testfile "watch-vfork"
+if { [build_executable ${testfile}.exp ${testfile} ${testfile}.c {debug}] } {
+    untested ${testfile}.exp
+    return -1
+}
+
+proc test_watchpoint_across_vfork { hw teststr } {
+    global testfile
+
+    clean_restart ${testfile}
+
+    if { ![runto main] } then {
+	fail "run to main ($teststr)"
+	return
+    }
+
+    if { ! $hw } {
+	gdb_test "set can-use-hw-watchpoints 0" "" ""
+    }
+
+    gdb_test "watch global" \
+	"atchpoint .*: global" \
+	"Watchpoint on global variable ($teststr)"
+
+    gdb_test "continue" \
+	"atchpoint .*: global.*" \
+	"Watchpoint triggers after vfork ($teststr)"
+}
+
+if { ![target_info exists gdb,no_hardware_watchpoints] } {
+    test_watchpoint_across_vfork 1 "hw"
+}
+
+test_watchpoint_across_vfork 0 "sw"
diff --git a/gdb/version.in b/gdb/version.in
index 6320344..0e67e74 100644
--- a/gdb/version.in
+++ b/gdb/version.in
@@ -1 +1 @@
-7.0.50.20091114-cvs
+7.0.50.20091116-cvs


hooks/post-receive
--
Repository for Project Archer.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]