public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
From: jkratoch@sourceware.org
To: archer-commits@sourceware.org
Subject: [SCM]  archer-jankratochvil-watchpoint3: Merge branch 'f-cleanup-fork-multifix' into archer-jankratochvil-watchpoint3
Date: Mon, 26 Dec 2011 22:04:00 -0000	[thread overview]
Message-ID: <20111226220420.14350.qmail@sourceware.org> (raw)

The branch, archer-jankratochvil-watchpoint3 has been updated
       via  4224070af09c2facd63f7ab0787daac7aa13a0e3 (commit)
       via  b3004f3496f049ce25337ddf41a7522318da68e9 (commit)
       via  7e3113fd8d8da416ec9402f0e5e2e9686e49409b (commit)
       via  4196976220a0625b610238a5e0df88fb83883a98 (commit)
       via  4073532487d6622005c7f6e60a455e79ab2c78d2 (commit)
       via  909aaaf58c29617ab0fb197e61402ab2a097e07b (commit)
       via  689c90f241f80eb3e54796bb42794c50e2cadc11 (commit)
      from  74a9c6ed99a4ca7f4983b6b33e5bf2a0ced2388a (commit)

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

- Log -----------------------------------------------------------------
commit 4224070af09c2facd63f7ab0787daac7aa13a0e3
Merge: 74a9c6e b3004f3
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Mon Dec 26 23:04:12 2011 +0100

    Merge branch 'f-cleanup-fork-multifix' into archer-jankratochvil-watchpoint3

commit b3004f3496f049ce25337ddf41a7522318da68e9
Merge: 4196976 7e3113f
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Mon Dec 26 23:01:24 2011 +0100

    Merge branch 'f-cleanup-fork' into f-cleanup-fork-multifix

commit 7e3113fd8d8da416ec9402f0e5e2e9686e49409b
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Mon Dec 26 23:01:16 2011 +0100

    .

commit 4196976220a0625b610238a5e0df88fb83883a98
Merge: 909aaaf 4073532
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Mon Dec 26 22:57:53 2011 +0100

    Merge branch 'f-cleanup-fork' into f-cleanup-fork-multifix
    
    Conflicts:
    	gdb/linux-nat.c

commit 4073532487d6622005c7f6e60a455e79ab2c78d2
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Mon Dec 26 22:57:07 2011 +0100

    .

commit 909aaaf58c29617ab0fb197e61402ab2a097e07b
Merge: 548f50b 689c90f
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Mon Dec 26 22:54:41 2011 +0100

    Merge branch 'f-cleanup-fork' into f-cleanup-fork-multifix

commit 689c90f241f80eb3e54796bb42794c50e2cadc11
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Mon Dec 26 22:54:38 2011 +0100

    .

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

Summary of changes:
 gdb/i386-nat.c      |   16 +++++++++++++++-
 gdb/linux-nat.c     |   27 +++++++++------------------
 gdb/ppc-linux-nat.c |    5 ++---
 3 files changed, 26 insertions(+), 22 deletions(-)

First 500 lines of diff:
diff --git a/gdb/i386-nat.c b/gdb/i386-nat.c
index a485851..18df921 100644
--- a/gdb/i386-nat.c
+++ b/gdb/i386-nat.c
@@ -210,7 +210,21 @@ i386_inferior_data_get (void)
 	{
 	  detached_inf_pid = ptid_get_pid (inferior_ptid);
  
-	  /* Forked processes get a copy of the debug registers.  */
+	  /* Linux kernel before 2.6.33 commit
+	     72f674d203cd230426437cdcf7dd6f681dad8b0d
+	     will inherit hardware debug registers from parent
+	     on fork/vfork/clone.  Newer Linux kernels create such tasks with
+	     zeroed debug registers.
+
+	     GDB will remove all breakpoints (and watchpoints) from the forked
+	     off process.  We also need to reset the debug registers in that
+	     process to be compatible with the older Linux kernels.
+
+	     Copy the debug registers mirrors into the new process so that all
+	     breakpoints and watchpoints can be removed together.  The debug
+	     registers mirror will become zeroed in the end before detaching
+	     the forked off process.  */
+
 	  memcpy (&detached_inf_data_local, inf_data,
 		  sizeof (detached_inf_data_local));
 	}
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index fa52ec2..09d7c1e 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -690,13 +690,10 @@ holding the child stopped.  Try \"set detach-on-fork\" or \
 	  make_cleanup (delete_lwp_cleanup, child_lp);
 
 	  /* CHILD_LP has new PID, therefore linux_nat_new_thread is not called for it.
-	     Still on Linux kernel before 2.6.33 commit
-	     72f674d203cd230426437cdcf7dd6f681dad8b0d
-	     fork/vfork/clone were inheriting the hardware debug registers from parent.
-	     Newer Linux kernels create such tasks with zeroed debug registers.
-	     Ensure linux_nat_prepare_to_resume will reset them during target_detach.
-	     It is ensured by the linux_nat_new_thread call, which is being skipped in
-	     add_lwp above for the first lwp of a pid.  */
+	     See i386_inferior_data_get for the Linux kernel specifics.
+	     Ensure linux_nat_prepare_to_resume will reset the hardware debug
+	     registers.  It is done by the linux_nat_new_thread call, which is
+	     being skipped in add_lwp above for the first lwp of a pid.  */
 	  gdb_assert (num_lwps (GET_PID (child_lp->ptid)) == 1);
 	  if (linux_nat_new_thread != NULL)
 	    linux_nat_new_thread (child_lp);
@@ -1280,13 +1277,7 @@ iterate_over_lwps (ptid_t filter,
 }
 
 /* Iterate like iterate_over_lwps does except when forking-off a child call
-   CALLBACK with CALLBACK_DATA specifically only for that new child PID.
-
-   During `set follow-fork-mode child' the call is also made for the new child
-   PID; parent watchpoints get detached elsewhere (during target_detach).
-
-   CALLBACK is being passed LWP as NULL for the detached process, read
-   INFERIOR_PTID's PID in such case.  */
+   CALLBACK with CALLBACK_DATA specifically only for that new child PID.  */
 
 void
 linux_nat_iterate_watchpoint_lwps
@@ -1297,22 +1288,22 @@ linux_nat_iterate_watchpoint_lwps
 
   if (inf->pid == inferior_pid)
     {
-      /* Standard mode.  Iterate all the threads of the current inferior.
-	 Without specifying INFERIOR_PID it would iterate all the threads of
-	 all the inferiors, which is inappropriate for watchpoints.  */
+      /* Iterate all the threads of the current inferior.  Without specifying
+	 INFERIOR_PID it would iterate all threads of all inferiors, which is
+	 inappropriate for watchpoints.  */
 
       iterate_over_lwps (pid_to_ptid (inferior_pid), callback, callback_data);
     }
   else
     {
       /* Detaching a new child PID temporarily present in INFERIOR_PID.  */
+
       struct lwp_info *child_lp;
       struct cleanup *old_chain;
       pid_t child_pid = GET_PID (inferior_ptid);
       ptid_t child_ptid = ptid_build (child_pid, child_pid, 0);
 
       gdb_assert (!is_lwp (inferior_ptid));
-      gdb_assert (find_lwp_pid (inferior_ptid) == NULL);
       gdb_assert (find_lwp_pid (child_ptid) == NULL);
       child_lp = add_lwp (child_ptid);
       child_lp->stopped = 1;
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
index f352196..921ed1c 100644
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -2024,11 +2024,10 @@ ppc_linux_can_accel_watchpoint_condition (CORE_ADDR addr, int len, int rw,
 static int
 set_saved_dabr_value_callback (struct lwp_info *lp, void *retp_voidp)
 {
-  /* If LP is NULL we are detaching a forked-off process.  */
-  pid_t tid = lp ? TIDGET (lp->ptid) : PIDGET (inferior_ptid);
   int *retp = retp_voidp;
 
-  if (ptrace (PTRACE_SET_DEBUGREG, tid, 0, saved_dabr_value) < 0)
+  if (ptrace (PTRACE_SET_DEBUGREG, TIDGET (lp->ptid), 0, saved_dabr_value)
+      < 0)
     *retp = -1;
 
   /* Continue the traversal.  */


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


             reply	other threads:[~2011-12-26 22:04 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-26 22:04 jkratoch [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-01-30 16:58 jkratoch
2012-01-24 14:19 jkratoch
2012-01-20 20:16 jkratoch
2012-01-20 11:07 jkratoch
2012-01-20  1:30 jkratoch
2012-01-20  1:20 jkratoch
2012-01-05  9:18 jkratoch
2012-01-02 22:43 jkratoch
2012-01-02 16:46 jkratoch
2012-01-02 15:19 jkratoch
2011-12-26 23:24 jkratoch
2011-12-26 20:32 jkratoch
2011-12-26 19:28 jkratoch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111226220420.14350.qmail@sourceware.org \
    --to=jkratoch@sourceware.org \
    --cc=archer-commits@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).