This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
src/gdb ChangeLog linux-nat.c gdbserver/Change ...
- From: palves at sourceware dot org
- To: gdb-cvs at sourceware dot org
- Date: Fri, 22 Mar 2013 14:52:26 +0000
- Subject: src/gdb ChangeLog linux-nat.c gdbserver/Change ...
CVSROOT: /cvs/src
Module name: src
Changes by: palves@sourceware.org 2013-03-22 14:52:26
Modified files:
gdb : ChangeLog linux-nat.c
gdb/gdbserver : ChangeLog linux-low.c
Log message:
Linux: No need to set ptrace event options in fork/clone children.
Oleg Nesterov told me that the Linux kernel copies the parent's ptrace
options to fork/clone children, so there's no need for GDB to do that
manually.
I was actually a bit surprised, since I thought the ptracer had to
always set the ptrace options itself, and GDB is indeed calling
PTRACE_SETOPTIONS for each new fork child, if it'll stay attached.
Looking at the history of that code, I found that is was actually I
who added that set-ptrace-options-in-children bit, back in
http://sourceware.org/ml/gdb-patches/2009-05/msg00656.html. But,
honestly, I don't recall why I needed that. I think I may have just
blindly believed it was necessary.
I then looked back at the history of all the PTRACE_SETOPTIONS code we
have, and found that gdb never did copy the ptrace options before my
patch. But, when gdbserver learnt to use PTRACE_EVENT_CLONE, at
http://sourceware.org/ml/gdb-patches/2007-10/msg00547.html, it was
made to do 'ptrace (PTRACE_SETOPTIONS, new_pid, 0,
PTRACE_O_TRACECLONE)' for all new clones. Hmmm. But, GDB itself
never did that, so it can't really ever have been necessary, I
believe, otherwise GDB should have been doing it too.
(GDBserver doesn't support following forks, and so naturally doesn't
do any PTRACE_SETOPTIONS on fork children.)
So this patch removes the -I believe- unnecessary ptrace syscalls.
Tested on x86_64 Fedora 17, native/gdbserver, and on x86_64 RHEL5
native/gdbserver (Linux 2.6.18, I think a ptrace-on-utrace kernel).
No regressions.
gdb/
2013-03-22 Pedro Alves <palves@redhat.com>
* linux-nat.c (linux_child_follow_fork): Don't call
linux_enable_event_reporting.
(linux_handle_extended_wait): Don't call
linux_enable_event_reporting.
gdb/gdbserver/
2013-03-22 Pedro Alves <palves@redhat.com>
* linux-low.c (handle_extended_wait): Don't call
linux_enable_event_reporting.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.15300&r2=1.15301
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/linux-nat.c.diff?cvsroot=src&r1=1.265&r2=1.266
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/gdbserver/ChangeLog.diff?cvsroot=src&r1=1.701&r2=1.702
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/gdbserver/linux-low.c.diff?cvsroot=src&r1=1.234&r2=1.235