From: Pedro Alves <palves@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 4/4] Fix PR gdb/19187 (process record over a fork causes internal error)
Date: Sun, 14 Feb 2016 18:44:00 -0000 [thread overview]
Message-ID: <1455475070-17797-5-git-send-email-palves@redhat.com> (raw)
In-Reply-To: <1455475070-17797-1-git-send-email-palves@redhat.com>
Right after a fork is detected, we detach breakpoints from the child
(detach_breakpoints), which calls into target_remove_breakpoint with
inferior_ptid pointing at the child process, but leaves the breakpoint
marked inserted (in the parent).
The problem is that record-full.c always deletes all knowledge of the
breakpoint. Then when we later really delete the breakpoint from the
parent, we fail the assertion, since the breakpoint is unexpectedly
not found in the record-full.c breakpoint table.
The fix is simply to not forget about the breakpoint if we're
detaching it from a fork child.
gdb/ChangeLog:
2016-02-14 Pedro Alves <palves@redhat.com>
PR gdb/19187
* record-full.c (record_full_remove_breakpoint): Don't remove the
breakpoint from the record_full_breakpoints VEC if we're detaching
the breakpoint from a fork child.
gdb/testsuite/ChangeLog:
2016-02-14 Pedro Alves <palves@redhat.com>
PR gdb/19187
* gdb.reverse/waitpid-reverse.exp: Add comment and remove
setup_kfails.
---
gdb/record-full.c | 7 +++++--
gdb/testsuite/gdb.reverse/waitpid-reverse.exp | 4 ++--
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/gdb/record-full.c b/gdb/record-full.c
index 418a346..e325869 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -1712,8 +1712,11 @@ record_full_remove_breakpoint (struct target_ops *ops,
return ret;
}
- VEC_unordered_remove (record_full_breakpoint_p,
- record_full_breakpoints, ix);
+ if (reason == REMOVE_BREAKPOINT)
+ {
+ VEC_unordered_remove (record_full_breakpoint_p,
+ record_full_breakpoints, ix);
+ }
return 0;
}
}
diff --git a/gdb/testsuite/gdb.reverse/waitpid-reverse.exp b/gdb/testsuite/gdb.reverse/waitpid-reverse.exp
index d583953..e8a1690 100644
--- a/gdb/testsuite/gdb.reverse/waitpid-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/waitpid-reverse.exp
@@ -18,6 +18,8 @@
#
# This test tests waitpid syscall for reverse execution.
#
+# Also serves as regression test for gdb/19187 (recording across a
+# fork).
if ![supports_reverse] {
return
@@ -40,14 +42,12 @@ gdb_test "break marker2" \
"Breakpoint $decimal at $hex: file .*$srcfile, line $decimal.*" \
"set breakpoint at marker2"
-setup_kfail "gdb/19187" *-*-*
gdb_continue_to_breakpoint "marker2" ".*$srcfile:.*"
gdb_test "break marker1" \
"Breakpoint $decimal at $hex: file .*$srcfile, line $decimal.*" \
"set breakpoint at marker1"
-setup_kfail "gdb/19187" *-*-*
gdb_test "reverse-continue" ".*$srcfile:$decimal.*" "reverse to marker1"
# If the variable was recorded properly on syscall, the old contents (-1)
--
1.9.3
next prev parent reply other threads:[~2016-02-14 18:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-14 18:37 [PATCH 0/4] " Pedro Alves
2016-02-14 18:37 ` [PATCH 3/4] Plumb enum remove_bp_reason all the way to target_remove_breakpoint Pedro Alves
2016-02-15 9:12 ` Yao Qi
2016-02-15 14:41 ` Pedro Alves
2016-02-14 18:37 ` [PATCH 1/4] Simplify remove_breakpoint interface Pedro Alves
2016-02-14 18:37 ` [PATCH 2/4] Introduce 'enum remove_bp_reason' Pedro Alves
2016-02-14 18:44 ` Pedro Alves [this message]
2016-08-10 22:11 ` [PATCH 0/4] Fix PR gdb/19187 (process record over a fork causes internal error) Pedro Alves
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=1455475070-17797-5-git-send-email-palves@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@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