Binutils with MCST patches
Go to file
Don Breazeal de0d863ec3 Extended-remote Linux follow fork
This patch implements basic support for follow-fork and detach-on-fork on
extended-remote Linux targets.  Only 'fork' is supported in this patch;
'vfork' support is added n a subsequent patch.  This patch depends on
the previous patches in the patch series.

Sufficient extended-remote functionality has been implemented here to pass
gdb.base/multi-forks.exp, as well as gdb.base/foll-fork.exp with the
catchpoint tests commented out.  Some other fork tests fail with this
patch because it doesn't provide the architecture support needed for
watchpoint inheritance or fork catchpoints.

The implementation follows the same general structure as for the native
implementation as much as possible.

This implementation includes:
 * enabling fork events in linux-low.c in initialize_low and
   linux_enable_extended_features

 * handling fork events in gdbserver/linux-low.c:handle_extended_wait

   - when a fork event occurs in gdbserver, we must do the full creation
     of the new process, thread, lwp, and breakpoint lists.  This is
     required whether or not the new child is destined to be
     detached-on-fork, because GDB will make target calls that require all
     the structures.  In particular we need the breakpoint lists in order
     to remove the breakpoints from a detaching child.  If we are not
     detaching the child we will need all these structures anyway.

   - as part of this event handling we store the target_waitstatus in a new
     member of the parent lwp_info structure, 'waitstatus'.  This
     is used to store extended event information for reporting to GDB.

   - handle_extended_wait is given a return value, denoting whether the
     handled event should be reported to GDB.  Previously it had only
     handled clone events, which were never reported.

 * using a new predicate in gdbserver to control handling of the fork event
   (and eventually all extended events) in linux_wait_1.  The predicate,
   extended_event_reported, checks a target_waitstatus.kind for an
   extended ptrace event.

 * implementing a new RSP 'T' Stop Reply Packet stop reason: "fork", in
   gdbserver/remote-utils.c and remote.c.

 * implementing new target and RSP support for target_follow_fork with
   target extended-remote.  (The RSP components were actually defined in
   patch 1, but they see their first use here).

   - remote target routine remote_follow_fork, which just sends the 'D;pid'
     detach packet to detach the new fork child cleanly.  We can't just
     call target_detach because the data structures for the forked child
     have not been allocated on the host side.

Tested on x64 Ubuntu Lucid, native, remote, extended-remote.

gdb/gdbserver/ChangeLog:

        * linux-low.c (handle_extended_wait): Implement return value,
        rename argument 'event_child' to 'event_lwp', handle
        PTRACE_EVENT_FORK, call internal_error for unrecognized event.
        (linux_low_ptrace_options): New function.
        (linux_low_filter_event): Call linux_low_ptrace_options,
        use different argument fo linux_enable_event_reporting,
        use return value from handle_extended_wait.
        (extended_event_reported): New function.
        (linux_wait_1): Call extended_event_reported and set
        status to report fork events.
        (linux_write_memory): Add pid to debug message.
        (reset_lwp_ptrace_options_callback): New function.
        (linux_handle_new_gdb_connection): New function.
        (linux_target_ops): Initialize new structure member.
        * linux-low.h (struct lwp_info) <waitstatus>: New member.
        * lynx-low.c: Initialize new structure member.
        * remote-utils.c (prepare_resume_reply): Implement stop reason
        "fork" for "T" stop message.
        * server.c (handle_query): Call handle_new_gdb_connection.
        * server.h (report_fork_events): Declare global flag.
        * target.h (struct target_ops) <handle_new_gdb_connection>:
        New member.
        (target_handle_new_gdb_connection): New macro.
        * win32-low.c: Initialize new structure member.

gdb/ChangeLog:

        * linux-nat.c (linux_nat_ptrace_options): New function.
        (linux_init_ptrace, wait_lwp, linux_nat_filter_event):
        Call linux_nat_ptrace_options and use different argument to
        linux_enable_event_reporting.
        (_initialize_linux_nat): Delete call to
        linux_ptrace_set_additional_flags.
        * nat/linux-ptrace.c (current_ptrace_options): Rename to
        supported_ptrace_options.
        (additional_flags): Delete variable.
        (linux_check_ptrace_features): Use supported_ptrace_options.
        (linux_test_for_tracesysgood, linux_test_for_tracefork):
        Likewise, and remove additional_flags check.
        (linux_enable_event_reporting): Change 'attached' argument to
        'options'.  Use supported_ptrace_options.
        (ptrace_supports_feature): Change comment.  Use
        supported_ptrace_options.
        (linux_ptrace_set_additional_flags): Delete function.
        * nat/linux-ptrace.h (linux_ptrace_set_additional_flags):
        Delete function prototype.
        * remote.c (remote_fork_event_p): New function.
        (remote_detach_pid): New function.
        (remote_detach_1): Call remote_detach_pid, don't mourn inferior
        if doing detach-on-fork.
        (remote_follow_fork): New function.
        (remote_parse_stop_reply): Handle new "T" stop reason "fork".
        (remote_pid_to_str): Print "process" strings for pid/0/0 ptids.
        (init_extended_remote_ops): Initialize to_follow_fork.
2015-05-12 09:52:43 -07:00
bfd Automatic date update in version.in 2015-05-12 00:00:07 +00:00
binutils Enables the -t abbreviated form of the --temp-prefix command line option for dlltool. 2015-05-12 11:16:03 +01:00
config Set zlibdir/zlibinc with top_builddir/top_srcdir 2015-04-02 05:43:07 -07:00
cpu or1k: add missing l.msync, l.psync and l.psync instructions. 2014-07-20 20:26:09 +03:00
elfcpp Add chdr_size, Chdr, Chdr_write and Chdr_data 2015-04-08 10:29:40 -07:00
etc PR external/{16327,16328}: Remove etc/configure.texi and etc/standards.texi. 2014-06-27 11:33:25 +02:00
gas Default e_machine to EM_IAMCU for i?86-*-elfiamcu 2015-05-11 12:06:33 -07:00
gdb Extended-remote Linux follow fork 2015-05-12 09:52:43 -07:00
gold Change Section_id type to use Relobj* instead of Object*. 2015-05-02 08:43:27 -07:00
gprof Updated translations for various binutils components. 2015-04-29 16:26:14 +01:00
include [AArch64] Add R_AARCH64_P32_LD32_GOTPAGE_LO14 to elf header 2015-05-12 13:47:15 +01:00
intl merge from gcc 2010-09-27 21:01:18 +00:00
ld Default e_machine to EM_IAMCU for i?86-*-elfiamcu 2015-05-11 12:06:33 -07:00
libdecnumber Another part of fixing "make TAGS". 2015-01-22 21:07:31 +02:00
libiberty libiberty/mkstemps.c: Include <time.h> if <sys/time.h> not available. 2015-05-08 10:15:28 -07:00
opcodes Remove Disp16|Disp32 from 64-bit direct branches 2015-05-11 14:20:37 -07:00
readline Fix executable indicator in file name completion on Windows. 2014-12-30 21:14:25 +02:00
sim Switch erc32 simulator copyright headers to FSF. 2015-05-08 07:23:15 -07:00
texinfo * texinfo/texinfo.tex: Update to version 2009-03-28.05. 2009-04-21 12:36:46 +00:00
zlib Add missing ChangeLog entry 2015-03-31 13:15:01 -07:00
.cvsignore add autom4te.cache to .cvsignore 2007-02-13 15:25:58 +00:00
.gitattributes Add a .gitattributes file for use with git-merge-changelog 2014-07-25 18:07:23 -04:00
.gitignore Sync the root .gitignore file with GCC's. 2013-01-11 15:17:35 +00:00
COPYING 2005-07-14 Kelley Cook <kcook@gcc.gnu.org> 2005-07-14 01:24:56 +00:00
COPYING.LIB 2005-07-16 Kelley Cook <kcook@gcc.gnu.org> 2005-07-16 02:41:34 +00:00
COPYING.LIBGLOSS 2013-01-07 Jeff Johnston <jjohnstn@redhat.com> 2013-01-07 21:39:26 +00:00
COPYING.NEWLIB 2013-10-01 Jeff Johnston <jjohnstn@redhat.com> 2013-10-01 18:14:04 +00:00
COPYING3 * COPYING3: New file. Contains version 3 of the GNU General Public License. 2007-07-17 13:50:23 +00:00
COPYING3.LIB * COPYING3: New file. Contains version 3 of the GNU General Public License. 2007-07-17 13:50:23 +00:00
ChangeLog Configure zlib with --enable-host-shared for shared bfd 2015-05-01 08:34:08 -07:00
MAINTAINERS Update description of ownership of files in include/ 2014-11-04 16:14:14 -08:00
Makefile.def Configure zlib with --enable-host-shared for shared bfd 2015-05-01 08:34:08 -07:00
Makefile.in Configure zlib with --enable-host-shared for shared bfd 2015-05-01 08:34:08 -07:00
Makefile.tpl Update top-level files from GCC trunk 2015-03-16 09:12:37 -07:00
README 19990502 sourceware import 1999-05-03 07:29:11 +00:00
README-maintainer-mode Cleanups after the update to Autoconf 2.64, Automake 1.11. 2009-08-22 17:08:11 +00:00
compile Update from upstream Automake 2014-11-16 13:43:48 +01:00
config-ml.in Sync config-ml.in with GCC trunk 2015-03-17 05:15:34 -07:00
config.guess Update config.guess and config.sub to the latest upstream version 2015-03-30 16:28:14 -04:00
config.rpath Remove freebsd1 from libtool.m4 macros and config.rpath. 2011-02-13 21:00:14 +00:00
config.sub Update config.guess and config.sub to the latest upstream version 2015-03-30 16:28:14 -04:00
configure Configure zlib with --enable-host-shared for shared bfd 2015-05-01 08:34:08 -07:00
configure.ac Configure zlib with --enable-host-shared for shared bfd 2015-05-01 08:34:08 -07:00
depcomp Update from upstream Automake 2014-11-16 13:43:48 +01:00
djunpack.bat * djunpack.bat: Use ".." quoting in Sed command, for the sake of 2009-03-27 13:37:09 +00:00
install-sh Update from upstream Automake 2014-11-16 13:43:48 +01:00
libtool.m4 Update libtool.m4 from GCC trunk 2014-11-24 09:14:09 -08:00
ltgcc.m4 * libtool.m4: Update to libtool 2.2.6. 2008-09-29 15:28:14 +00:00
ltmain.sh PR target/59788 2014-02-06 11:01:57 +01:00
ltoptions.m4 Sync Libtool from GCC. 2010-01-09 21:11:44 +00:00
ltsugar.m4 * libtool.m4: Update to libtool 2.2.6. 2008-09-29 15:28:14 +00:00
ltversion.m4 Sync Libtool from GCC. 2010-01-09 21:11:44 +00:00
lt~obsolete.m4 Sync Libtool from GCC. 2010-01-09 21:11:44 +00:00
makefile.vms 19990502 sourceware import 1999-05-03 07:29:11 +00:00
missing Update from upstream Automake 2014-11-16 13:43:48 +01:00
mkdep * mkdep: New file. 1999-08-08 17:46:02 +00:00
mkinstalldirs Update from upstream Automake 2014-11-16 13:43:48 +01:00
move-if-change Update `move-if-change' from gnulib 2014-11-16 17:04:02 +01:00
setup.com 2009-09-01 Tristan Gingold <gingold@adacore.com> 2009-09-01 13:38:26 +00:00
src-release.sh Adjust src-release.sh for sim using the gdb create-version.sh. 2015-04-15 04:08:51 +02:00
symlink-tree 2005-07-14 Kelley Cook <kcook@gcc.gnu.org> 2005-07-14 01:24:56 +00:00
ylwrap Update from upstream Automake 2014-11-16 13:43:48 +01:00

README

		   README for GNU development tools

This directory contains various GNU compilers, assemblers, linkers, 
debuggers, etc., plus their support routines, definitions, and documentation.

If you are receiving this as part of a GDB release, see the file gdb/README.
If with a binutils release, see binutils/README;  if with a libg++ release,
see libg++/README, etc.  That'll give you info about this
package -- supported targets, how to use it, how to report bugs, etc.

It is now possible to automatically configure and build a variety of
tools with one command.  To build all of the tools contained herein,
run the ``configure'' script here, e.g.:

	./configure 
	make

To install them (by default in /usr/local/bin, /usr/local/lib, etc),
then do:
	make install

(If the configure script can't determine your type of computer, give it
the name as an argument, for instance ``./configure sun4''.  You can
use the script ``config.sub'' to test whether a name is recognized; if
it is, config.sub translates it to a triplet specifying CPU, vendor,
and OS.)

If you have more than one compiler on your system, it is often best to
explicitly set CC in the environment before running configure, and to
also set CC when running make.  For example (assuming sh/bash/ksh):

	CC=gcc ./configure
	make

A similar example using csh:

	setenv CC gcc
	./configure
	make

Much of the code and documentation enclosed is copyright by
the Free Software Foundation, Inc.  See the file COPYING or
COPYING.LIB in the various directories, for a description of the
GNU General Public License terms under which you can copy the files.

REPORTING BUGS: Again, see gdb/README, binutils/README, etc., for info
on where and how to report problems.